| 1 | // reply and/or fldadd Similar in col jd;jd;jd [attribute] |
|---|
| 2 | |
|---|
| 3 | if (jk_n /*joinjd*/) { |
|---|
| 4 | |
|---|
| 5 | RECSTRU *recp; |
|---|
| 6 | #if 0 |
|---|
| 7 | char jd[32000]; |
|---|
| 8 | int jdsize=32000; |
|---|
| 9 | #endif |
|---|
| 10 | int i,noc,repliedkeys=0; |
|---|
| 11 | int debug=(cmd >= 3)?1:0; |
|---|
| 12 | |
|---|
| 13 | //freq - Similar in col |
|---|
| 14 | memset(JDSIMFREQ,0x00,jdmaxprim*sizeof(LONGX)); |
|---|
| 15 | memset(JDSIMPESO,0x00,jdmaxprim*sizeof(float)); |
|---|
| 16 | |
|---|
| 17 | //RECORD(irec,coljdb,l->mfn); |
|---|
| 18 | RECORD(irec,collectiondb,l->mfn); |
|---|
| 19 | |
|---|
| 20 | if (RECrc != RCNORMAL) ; //fatal("wtrig2/jd/RCNORMAL"); |
|---|
| 21 | else { |
|---|
| 22 | |
|---|
| 23 | if (batchp) { |
|---|
| 24 | sprintf(batchp,"<7 0>%"_LD_"^s%f^m%"_LD_"^h%"_LD_"^1",l->mfn,l->sim,l->xxx,l->hit); |
|---|
| 25 | batchp+=strlen(batchp); |
|---|
| 26 | } |
|---|
| 27 | #if 0 |
|---|
| 28 | for (i=1, noc=nocc(irec,joinjd/*TAG440*/); i <= noc; i++) { // for each TAG440 occ |
|---|
| 29 | int left; |
|---|
| 30 | char *jdp=jd; |
|---|
| 31 | recfield(jd,irec,joinjd/*TAG440*/,i,""); |
|---|
| 32 | left=strlen(jd); |
|---|
| 33 | #else |
|---|
| 34 | for (i=0, noc=jd_n; i < noc; i++) { // for each jd_occ |
|---|
| 35 | |
|---|
| 36 | int left,lns; |
|---|
| 37 | char *jdp=jd_areap; |
|---|
| 38 | |
|---|
| 39 | int j,jki=(-1); |
|---|
| 40 | for (j=0; j < jk_n; j++) if (i == jk_jdi[j]) { jki=j; break; } |
|---|
| 41 | if (jki < 0) continue; |
|---|
| 42 | |
|---|
| 43 | *jd_areap = '\0'; /* call format */ |
|---|
| 44 | lns=fmt_inter(jd_pgmp[i],irec,jd_asize,jd_areap,jd_asize); |
|---|
| 45 | if (lns < 0) left=0; //fatal("wtrig2/jd/format execution error"); |
|---|
| 46 | else left=strlen(jd_areap); |
|---|
| 47 | #endif |
|---|
| 48 | if (left) { // for each jd |
|---|
| 49 | char *p; |
|---|
| 50 | for (p=jdp; left; ) { // for all chars |
|---|
| 51 | int keylen; |
|---|
| 52 | char *keyp; |
|---|
| 53 | |
|---|
| 54 | //strip |
|---|
| 55 | while (isspace(*p) || *p==';') if (left) { p++; left--; } |
|---|
| 56 | if (!left) break; |
|---|
| 57 | |
|---|
| 58 | //new jd value |
|---|
| 59 | keyp=p; |
|---|
| 60 | for (keylen=0; left; p++, keylen++, left--) { |
|---|
| 61 | if (*p=='\n' || *p=='\r' || *p==';') break; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | if (keylen) { |
|---|
| 65 | LONGX hidx; |
|---|
| 66 | int found; |
|---|
| 67 | char *h; |
|---|
| 68 | hidx=hashindex(jdtable,jdmaxprim,jdtabwidth,keyp,keylen,&found,1); |
|---|
| 69 | if (!found) jdtabentries++; |
|---|
| 70 | h=jdtable+hidx*jdhwidth; |
|---|
| 71 | if (/*parmdebug*/debug) fprintf(stderr,"+++ table.hidx=%"_LD_" [%"_LD_"] table.h='%s'\n",hidx,jdtabentries,h); |
|---|
| 72 | JDCOLFREQ[hidx]++; |
|---|
| 73 | JDDOCFREQ[hidx]++; |
|---|
| 74 | JDSIMFREQ[hidx]++; |
|---|
| 75 | JDCOLPESO[hidx]+=l->sim; |
|---|
| 76 | JDDOCPESO[hidx]+=l->sim; |
|---|
| 77 | JDSIMPESO[hidx]+=l->sim; |
|---|
| 78 | |
|---|
| 79 | // reply Similar in col jd;jd;jd; [attribute] |
|---|
| 80 | if (reply) if (joinjd) { |
|---|
| 81 | unsigned char *p; |
|---|
| 82 | if (!repliedkeys) { |
|---|
| 83 | sprintf(reply," jd=\""); |
|---|
| 84 | reply+=strlen(reply); |
|---|
| 85 | } |
|---|
| 86 | if (repliedkeys) { |
|---|
| 87 | sprintf(reply,"; "); |
|---|
| 88 | reply+=strlen(reply); |
|---|
| 89 | } |
|---|
| 90 | if (debug) { sprintf(reply,"%d:",hidx); reply+=strlen(reply); } |
|---|
| 91 | for (p=h; *p; p++) { |
|---|
| 92 | if (convent[*p]) { strcpy(reply,convent[*p]); reply+=strlen(reply); } |
|---|
| 93 | else *reply++ = *p; |
|---|
| 94 | } |
|---|
| 95 | repliedkeys++; |
|---|
| 96 | } |
|---|
| 97 | if (batchp) { |
|---|
| 98 | sprintf(batchp,"%d %s%s",hidx,h,";"); // <7> |
|---|
| 99 | batchp+=strlen(batchp); |
|---|
| 100 | } |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | } // end for all chars |
|---|
| 104 | |
|---|
| 105 | } // end for each jd |
|---|
| 106 | |
|---|
| 107 | } // end for each TAG440 occ |
|---|
| 108 | |
|---|
| 109 | if (batchp) { |
|---|
| 110 | sprintf(batchp,"</7>"); |
|---|
| 111 | batchp+=strlen(batchp); |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | } // end RCNORMAL |
|---|
| 115 | |
|---|
| 116 | if (reply) { |
|---|
| 117 | if (repliedkeys) { |
|---|
| 118 | sprintf(reply,"\""); |
|---|
| 119 | reply+=strlen(reply); |
|---|
| 120 | } |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | } // end jd reply |
|---|