Repositories » TXT0 Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

struct Doc now holds a sum(tf^2) in sumsq.

Changeset 31ed6555d40e

Parent 316c0109c1e6

by Rup Palchowdhury

Changes to 3 files · Browse files at 31ed6555d40e Showing diff from parent 316c0109c1e6 Diff from another changeset...

Change 1 of 2 Show Entire File ii.c Stacked
 
89
90
91
92
 
93
94
95
 
112
113
114
115
 
 
116
117
118
 
89
90
91
 
92
93
94
95
 
112
113
114
 
115
116
117
118
119
@@ -89,7 +89,7 @@
 void buildii(Hash *hdoc, Hash *hterm, FILE *fp)  {   int pflag_, tflag_; - uint32_t k, k_, n_term, n_uterm, tf; + uint32_t k, k_, n_term, n_uterm, sumsq, tf;   char ts[KB];   THeader *h;   TDoc *tdoc; @@ -112,7 +112,8 @@
    sscanf(tdoc->rsrc[0], "%u", &n_term);   sscanf(tdoc->rsrc[1], "%u", &n_uterm); - doc = newdoc(tdoc->id, n_term, n_uterm, tdoc->h->n_txt); + sscanf(tdoc->rsrc[2], "%u", &sumsq); + doc = newdoc(tdoc->id, n_term, n_uterm, tdoc->h->n_txt, sumsq);   npdoc_ = newnode(doc);   npdoc = hlookup(hdoc, npdoc_, 1);   if (npdoc != npdoc_) /* a repeating doc id */
Change 1 of 2 Show Entire File txt.c Stacked
 
7
8
9
10
 
11
12
13
14
15
16
17
 
 
18
19
20
 
52
53
54
55
 
 
56
57
58
 
7
8
9
 
10
11
12
13
14
15
16
 
17
18
19
20
21
 
53
54
55
 
56
57
58
59
60
@@ -7,14 +7,15 @@
   /* Doc */   -Doc *newdoc(char *id, uint32_t n_term, uint32_t n_uterm, uint32_t n_byte) +Doc *newdoc(char *id, uint32_t n_term, uint32_t n_uterm, uint32_t n_byte, uint32_t sumsq)  {   Doc *d;   d = (Doc *)emalloc(sizeof(Doc));   d->id = estrdup(id);   d->n_term = n_term;   d->n_uterm = n_uterm; - d->n_byte = n_byte; + d->n_byte = n_byte; + d->sumsq = sumsq;   return d;  }   @@ -52,7 +53,8 @@
 {   Doc *d;   d = (Doc *)data; - fprintf(stream, " %s:%u:%u:%u", d->id, d->n_term, d->n_uterm, d->n_byte); + fprintf(stream, " %s:%u:%u:%u:%u", d->id, + d->n_term, d->n_uterm, d->n_byte, d->sumsq);  }    /* Query */
Change 1 of 2 Show Entire File txt.h Stacked
 
8
9
10
 
11
12
13
 
28
29
30
31
 
32
33
34
 
8
9
10
11
12
13
14
 
29
30
31
 
32
33
34
35
@@ -8,6 +8,7 @@
  uint32_t n_term;   uint32_t n_uterm;   uint32_t n_byte; + uint32_t sumsq;  };    struct Query { @@ -28,7 +29,7 @@
  int tf;  };   -Doc *newdoc(char*, uint32_t, uint32_t, uint32_t); +Doc *newdoc(char*, uint32_t, uint32_t, uint32_t, uint32_t);  void freedoc(void*);  int cmpdoc(void*, void*);  unsigned hashdoc(void*, unsigned);