X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=index%2Fextract.c;h=18cac3d597c58577d9346d69cc32ed0805d2f728;hb=7c3a0352f0492609a3b6b26b63a72b0b2d207aab;hp=9561c6e330d02e6a713f42e84d2112b1720e71ec;hpb=2e4e9c6def27f1e1463dcb6f205fab6a98054f38;p=idzebra-moved-to-github.git diff --git a/index/extract.c b/index/extract.c index 9561c6e..18cac3d 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.158 2004-08-04 08:35:23 adam Exp $ +/* $Id: extract.c,v 1.161 2004-09-14 14:38:07 quinn Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -72,7 +72,8 @@ static void logRecord (ZebraHandle zh) ++zh->records_processed; if (!(zh->records_processed % 1000)) { - logf (LOG_LOG, "Records: %7d i/u/d %d/%d/%d", + logf (LOG_LOG, "Records: "ZINT_FORMAT" i/u/d " + ZINT_FORMAT"/"ZINT_FORMAT"/"ZINT_FORMAT, zh->records_processed, zh->records_inserted, zh->records_updated, zh->records_deleted); } @@ -114,9 +115,9 @@ static const char **searchRecordKey (ZebraHandle zh, iscz1_decode(decode_handle, &dst, &src); assert(key.len < 4 && key.len > 2); - attrSet = key.mem[0]; - attrUse = key.mem[1]; - seqno = key.mem[2]; + attrSet = (int) key.mem[0]; + attrUse = (int) key.mem[1]; + seqno = (int) key.mem[2]; if (attrUseS == attrUse && attrSetS == attrSet) { @@ -1331,13 +1332,12 @@ void extract_flushRecordKeys (ZebraHandle zh, SYSNO sysno, iscz1_decode(decode_handle, &dst, &src); assert(key.len < 4 && key.len > 2); - attrSet = key.mem[0]; - attrUse = key.mem[1]; /* sequence in mem[2] */ + attrSet = (int) key.mem[0]; + attrUse = (int) key.mem[1]; /* sequence in mem[2] */ if (zh->reg->key_buf_used + 1024 > (zh->reg->ptr_top -zh->reg->ptr_i)*sizeof(char*)) extract_flushWriteKeys (zh,0); - assert(zh->reg->ptr_i >= 0); ++(zh->reg->ptr_i); assert(zh->reg->ptr_i > 0); (zh->reg->key_buf)[zh->reg->ptr_top - zh->reg->ptr_i] = @@ -1738,7 +1738,7 @@ static void extract_add_incomplete_field (RecWord *p) const char **map = 0; if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain); + map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain, 0); while (map) { @@ -1750,7 +1750,7 @@ static void extract_add_incomplete_field (RecWord *p) { remain = p->length - (b - p->string); if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain); + map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain, 0); else map = 0; } @@ -1765,7 +1765,7 @@ static void extract_add_incomplete_field (RecWord *p) buf[i++] = *(cp++); remain = p->length - (b - p->string); if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain); + map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain, 0); else map = 0; } @@ -1782,9 +1782,12 @@ static void extract_add_complete_field (RecWord *p) char buf[IT_MAX_WORD+1]; const char **map = 0; int i = 0, remain = p->length; + int first; /* first position */ + +yaz_log(LOG_DEBUG, "Complete field, w='%s'", p->string); if (remain > 0) - map = zebra_maps_input (p->zebra_maps, p->reg_type, &b, remain); + map = zebra_maps_input (p->zebra_maps, p->reg_type, &b, remain, 1); while (remain > 0 && i < IT_MAX_WORD) { @@ -1793,7 +1796,10 @@ static void extract_add_complete_field (RecWord *p) remain = p->length - (b - p->string); if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain); + { + first = i ? 0 : 1; + map = zebra_maps_input(p->zebra_maps, p->reg_type, &b, remain, first); + } else map = 0; } @@ -1814,13 +1820,16 @@ static void extract_add_complete_field (RecWord *p) { if (i >= IT_MAX_WORD) break; +yaz_log(LOG_DEBUG, "Adding string to index '%d'", *map); while (i < IT_MAX_WORD && *cp) buf[i++] = *(cp++); } remain = p->length - (b - p->string); if (remain > 0) + { map = zebra_maps_input (p->zebra_maps, p->reg_type, &b, - remain); + remain, 0); + } else map = 0; }