Bug fix for deletes (max_item 2)
[idzebra-moved-to-github.git] / index / retrieve.c
index 9b8baae..650eb82 100644 (file)
@@ -4,7 +4,13 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: retrieve.c,v $
- * Revision 1.15  2002-04-04 14:14:13  adam
+ * Revision 1.17  2002-05-03 13:49:04  adam
+ * play with shellsort
+ *
+ * Revision 1.16  2002/04/04 20:50:37  adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.15  2002/04/04 14:14:13  adam
  * Multiple registers (alpha early)
  *
  * Revision 1.14  2001/01/22 11:41:41  adam
@@ -65,6 +71,7 @@
 #endif
 
 #include "index.h"
+#include <direntz.h>
 
 int zebra_record_ext_read (void *fh, char *buf, size_t count)
 {
@@ -170,10 +177,22 @@ int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
     }
     else
     {
-        if ((fc.fd = open (fname, O_BINARY|O_RDONLY)) == -1)
+        char full_rep[1024];
+
+        if (zh->path_reg && !yaz_is_abspath (fname))
+        {
+            strcpy (full_rep, zh->path_reg);
+            strcat (full_rep, "/");
+            strcat (full_rep, fname);
+        }
+        else
+            strcpy (full_rep, fname);
+        
+
+        if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
         {
             logf (LOG_WARN|LOG_ERRNO, "Retrieve fail; missing file: %s",
-                 fname);
+                 full_rep);
             rec_rm (&rec);
             return 14;
         }
@@ -195,6 +214,9 @@ int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
     retrieveCtrl.diagnostic = 0;
     retrieveCtrl.dh = zh->reg->dh;
     retrieveCtrl.res = zh->res;
+    retrieveCtrl.rec_buf = 0;
+    retrieveCtrl.rec_len = -1;
+    
     (*rt->retrieve)(clientData, &retrieveCtrl);
     *output_format = retrieveCtrl.output_format;
     *rec_bufp = (char *) retrieveCtrl.rec_buf;