Call flushSortKeys when record is skipped to fix bad re-use of
[idzebra-moved-to-github.git] / index / extract.c
index 366c6ec..5fa2b04 100644 (file)
@@ -1,10 +1,18 @@
 /*
- * Copyright (C) 1994-2000, Index Data 
+ * Copyright (C) 1994-2001, Index Data 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.105  2000-12-05 10:01:44  adam
+ * Revision 1.107  2001-05-28 13:58:48  adam
+ * Call flushSortKeys when record is skipped to fix bad re-use of
+ * sort keys to whatever next record that comes in.
+ *
+ * Revision 1.106  2000/12/05 12:22:53  adam
+ * Termlist source implemented (so that we can index values of XML/SGML
+ * attributes).
+ *
+ * Revision 1.105  2000/12/05 10:01:44  adam
  * Fixed bug regarding user-defined attribute sets.
  *
  * Revision 1.104  2000/09/05 14:04:05  adam
@@ -750,8 +758,6 @@ static void addIndexString (RecWord *p, const char *string, int length)
         if (ch < 0)
         {
             ch = zebraExplain_addSU (zti, attrSet, attrUse);
-            yaz_log (LOG_LOG, "addSU set=%d use=%d SU=%d",
-                     attrSet, attrUse, ch);
         }
        assert (ch > 0);
        memcpy (dst, &ch, sizeof(ch));
@@ -927,8 +933,11 @@ static void flushSortKeys (SYSNO sysno, int cmd)
     while (sk)
     {
        struct sortKey *sk_next = sk->next;
-       sortIdx_type (sortIdx, sk->attrUse);
-       sortIdx_add (sortIdx, sk->string, sk->length);
+       if (cmd >= 0)
+       {
+           sortIdx_type (sortIdx, sk->attrUse);
+           sortIdx_add (sortIdx, sk->string, sk->length);
+       }
        xfree (sk->string);
        xfree (sk);
        sk = sk_next;
@@ -1510,6 +1519,7 @@ static int recordExtract (SYSNO *sysno, const char *fname,
        {
            logf (LOG_LOG, "skipped %s %s " PRINTF_OFF_T, rGroup->recordType,
                  fname, recordOffset);
+           flushSortKeys (*sysno, -1);
            rec_rm (&rec);
            logRecord (0);
            return 1;