X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=index%2Fextract.c;h=0486bb6eb55198e787c5bb2cc8cb9c102b0503ce;hb=4ed5fbcd29d2a98b048d1d94510b262d352b4f7c;hp=ebd04ac0c4bc7e590b79b2f0aa183473916fdfd5;hpb=3c5f6226f97612c0d6ac40591f600587c5ffa858;p=idzebra-moved-to-github.git diff --git a/index/extract.c b/index/extract.c index ebd04ac..0486bb6 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,16 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.90 1999-02-02 14:50:52 adam + * Revision 1.93 1999-05-15 14:36:38 adam + * Updated dictionary. Implemented "compression" of dictionary. + * + * Revision 1.92 1999/03/09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.91 1999/02/12 13:29:22 adam + * Implemented position-flag for registers. + * + * Revision 1.90 1999/02/02 14:50:52 adam * Updated WIN32 code specific sections. Changed header. * * Revision 1.89 1998/10/28 10:54:38 adam @@ -399,7 +408,7 @@ int key_open (struct recordGroup *rGroup, int mem) key_buf_used = 0; key_file_no = 0; - if (!(matchDict = dict_open (bfs, GMATCH_DICT, 50, rw))) + if (!(matchDict = dict_open (bfs, GMATCH_DICT, 50, rw, 0))) { logf (LOG_FATAL, "dict_open fail of %s", GMATCH_DICT); return -1; @@ -426,6 +435,7 @@ int key_open (struct recordGroup *rGroup, int mem) struct encode_info { int sysno; int seqno; + int cmd; char buf[768]; }; @@ -433,6 +443,7 @@ void encode_key_init (struct encode_info *i) { i->sysno = 0; i->seqno = 0; + i->cmd = -1; } char *encode_key_int (int d, char *bp) @@ -474,8 +485,11 @@ void encode_key_write (char *k, struct encode_info *i, FILE *outf) i->sysno = key.sysno; i->seqno = 0; } + else if (!i->seqno && !key.seqno && i->cmd == *k) + return; bp = encode_key_int (key.seqno - i->seqno, bp); i->seqno = key.seqno; + i->cmd = *k; if (fwrite (i->buf, bp - i->buf, 1, outf) != 1) { logf (LOG_FATAL|LOG_ERRNO, "fwrite"); @@ -696,7 +710,8 @@ static void addIndexString (RecWord *p, const char *string, int length) dst += sizeof(*pseqno); } reckeys.buf_used = dst - reckeys.buf; - (*pseqno)++; + if (*pseqno) + (*pseqno)++; } static void addSortString (RecWord *p, const char *string, int length) @@ -1258,7 +1273,12 @@ static int recordExtract (SYSNO *sysno, const char *fname, extractCtrl.addSchema = addSchema; extractCtrl.dh = rGroup->dh; for (i = 0; i<256; i++) - extractCtrl.seqno[i] = 0; + { + if (zebra_maps_is_positioned(rGroup->zebra_maps, i)) + extractCtrl.seqno[i] = 1; + else + extractCtrl.seqno[i] = 0; + } extractCtrl.zebra_maps = rGroup->zebra_maps; extractCtrl.flagShowRecords = !rGroup->flagRw; @@ -1620,14 +1640,17 @@ int fileExtract (SYSNO *sysno, const char *fname, rGroup->flagStoreKeys = 0; #if ZEBRASDR - if (1) + if (rGroup->useSDR) { ZebraSdrHandle h; char xname[128], *xp; strncpy (xname, fname, 127); - if ((xp = strchr (xname, '.'))) - *xp = '\0'; + if (!(xp = strchr (xname, '.'))) + return 0; + *xp = '\0'; + if (strcmp (xp+1, "sdr.bits")) + return 0; h = zebraSdr_open (xname); if (!h) @@ -1643,9 +1666,8 @@ int fileExtract (SYSNO *sysno, const char *fname, segmentno = zebraSdr_segment (h, 0); sprintf (sdr_name, "%%%s.%d", xname, segmentno); - logf (LOG_LOG, "SDR: %s", sdr_name); -#if 1 +#if 0 if (segmentno > 20) break; #endif