New parameter: result-set file descriptor (RSFD) to support multiple
[idzebra-moved-to-github.git] / index / zsets.c
index 223103a..636c5e4 100644 (file)
@@ -1,10 +1,22 @@
 /*
- * Copyright (C) 1995, Index Data I/S 
+ * Copyright (C) 1994-1995, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zsets.c,v $
- * Revision 1.1  1995-09-05 15:28:40  adam
+ * Revision 1.4  1995-09-07 13:58:36  adam
+ * New parameter: result-set file descriptor (RSFD) to support multiple
+ * positions within the same result-set.
+ * Boolean operators: and, or, not implemented.
+ * Result-set references.
+ *
+ * Revision 1.3  1995/09/06  16:11:19  adam
+ * Option: only one word key per file.
+ *
+ * Revision 1.2  1995/09/06  10:33:04  adam
+ * More work on present. Some log messages removed.
+ *
+ * Revision 1.1  1995/09/05  15:28:40  adam
  * More work on search engine.
  *
  */
@@ -57,6 +69,7 @@ ZServerRecord *resultSetRecordGet (ZServerInfo *zi, const char *name,
     int position = 0;
     int psysno = 0;
     struct it_key key;
+    RSFD rfd;
 
     if (!(sset = resultSetGet (zi, name)))
         return NULL;
@@ -64,10 +77,9 @@ ZServerRecord *resultSetRecordGet (ZServerInfo *zi, const char *name,
         return NULL;
     logf (LOG_DEBUG, "resultSetRecordGet");
     sr = xmalloc (sizeof(*sr) * num);
-    rset_open (rset, 0);
-    while (rset_read (rset, &key))
+    rfd = rset_open (rset, 0);
+    while (rset_read (rset, rfd, &key))
     {
-        logf (LOG_DEBUG, "resultSetRecordGet: %d", key.sysno);
         if (key.sysno != psysno)
         {
             psysno = key.sysno;
@@ -77,7 +89,6 @@ ZServerRecord *resultSetRecordGet (ZServerInfo *zi, const char *name,
                 FILE *inf;
                 char fname[SYS_IDX_ENTRY_LEN];
 
-                logf (LOG_DEBUG, "get sysno=%d", psysno);
                 sr[num_i].buf = NULL;
                 if (lseek (zi->sys_idx_fd, psysno * SYS_IDX_ENTRY_LEN,
                            SEEK_SET) == -1)
@@ -117,7 +128,13 @@ ZServerRecord *resultSetRecordGet (ZServerInfo *zi, const char *name,
             }
         }
     }
-    rset_close (rset);
+    rset_close (rset, rfd);
+    while (num_i < num)
+    {
+        sr[num_i].buf = NULL;
+        sr[num_i].size = 0;
+        num_i++;
+    }
     return sr;
 }