Bug fix: default storeKeys setting wasn't read when group was specified.
[idzebra-moved-to-github.git] / index / extract.c
index 366c6ec..305cc18 100644 (file)
@@ -1,10 +1,21 @@
 /*
- * 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.108  2001-06-14 11:44:56  adam
+ * Bug fix: default storeKeys setting wasn't read when group was specified.
+ *
+ * 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 +761,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 +936,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 +1522,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;
@@ -1755,11 +1768,14 @@ int fileExtract (SYSNO *sysno, const char *fname,
         const char *sval;
 
         sprintf (ext_res, "%sstoreKeys.%s", gprefix, ext);
-        if (!(sval = res_get (common_resource, ext_res)))
+        sval = res_get (common_resource, ext_res);
+       if (!sval)
         {
             sprintf (ext_res, "%sstoreKeys", gprefix);
             sval = res_get (common_resource, ext_res);
         }
+       if (!sval)
+           sval = res_get (common_resource, "storeKeys");
         if (sval)
             rGroup->flagStoreKeys = atoi (sval);
     }