root/trunk/w2rhit.c

Revision 389, 3.4 kB (checked in by heitor.barbieri, 3 weeks ago)

essage first commit

Line 
1            /* read term's postings from invertedmf and OR them (mfns) into HIT
2            */
3            if (*colxdb) {
4                RECORD(ifrec,colxdb,dochidx+1);
5            } /* end if colxdb */
6            //if (RECrc != RCNORMAL) fatal("wtrig2/colxdb/deleted");
7            if (*colxdb) if (RECrc == RCNORMAL) {
8                LONGX nmfns=0;
9                for (dirp2=MFRdir, xdir2=0, loop=MFRnvf; loop--; dirp2++, xdir2++) {
10                    if (dirp2->tag != TAG33) continue;
11                    for (keylen2=0, p=fldp2=FIELDP(xdir2), left=dirp2->len; left; ) {
12                        if (*p == '^') {
13                            if (left < 2 ) fatal("wtrig2/colxdb/nhits/left");
14                            if (*++p != 'n') fatal("wtrig2/colxdb/nhits/left");
15                            left-=2;
16                            while (left) {
17                                if (!isdigit(*++p)) break;
18                                nmfns=nmfns*10+((int)(*p)-(int)'0');
19                                left--;
20                            }
21                            break;
22                        }
23                        keylen2++; p++; left--;
24                    }
25                }
26                if (keylen2 != keylen) fatal("wtrig2/colxdb/keylen");
27                if (memcmp(fldarea,fldp2,keylen)) fatal("wtrig2/colxdb/key");
28
29                if (parmtrace & 0x04) printf(" 4|%"_LD_"|%s|%"_LD_"|%f\n",docmfn,table+dochidx*hwidth,MFRmfn,weight);
30
31                /* loop through term's postings and OR the mfn's bit */
32                if (alwaysmakemfnhits) {
33                    int n=sizeof(hitmfn);
34                    for (dirp2=MFRdir, xdir2=0, loop=MFRnvf; loop--; dirp2++, xdir2++) {
35                        if (dirp2->tag != TAG5) continue;
36                        left=dirp2->len;
37                        if (left < n*nmfns) fatal("wtrig2/colxdb/bin/left/1");
38                        for (p=FIELDP(xdir2); left; ) {
39                            memcpy((void *)&hitmfn,p,n);
40                            p+=n; left-=n;
41                            if (left < 0) fatal("wtrig2/colxdb/bin/left/2");
42                            if (hitmfn < 1) fatal("wtrig2/colxdb/bin/mfn invalid/1");
43                            if (hitmfn > COLLECTION_SIZE) {
44                                fatal("wtrig2/colxdb/bin/mfn invalid/2");
45                            }
46                            hitmask =hitbitmask[hitmfn&BY8RMASK];
47                            hitoffset = hitmfn/8;
48#if PARMLANG
49                            /* filter language hits */
50                            if (langidx >= 0) {
51                                unsigned char c = *(langshits[langidx]+hitoffset);
52                                if (c & hitmask)
53                                    HITS[hitoffset] |= hitmask;
54                            }
55                            else
56#endif /* PARMLANG */
57                            HITS[hitoffset] |= hitmask;
58                            if (parmtrace & 0x08) printf(" 8|%"_LD_"|%s|%"_LD_"|%"_LD_"|%d/%d/%d|%d/%"_LD_"\n",docmfn,table+dochidx*hwidth,hitmfn,MFRmfn,loop,xdir,left,n,nmfns);
59                        }
60                        break;
61                    } /* end term postings */
62                }
63            } /* end if RECrc == RCNORMAL */
64
65            recp=keeprecp; /* restore current recp */
66
67            /* end read term's postings from invertedmf and OR them (mfns) into HIT */
Note: See TracBrowser for help on using the browser.