Moved truncation code to trunc.c.
[idzebra-moved-to-github.git] / index / extract.c
index 9a08b1b..743d174 100644 (file)
@@ -1,10 +1,26 @@
 /*
- * Copyright (C) 1994-1995, Index Data I/S 
+ * Copyright (C) 1994-1996, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.58  1996-05-14 06:16:38  adam
+ * Revision 1.63  1996-10-29 14:09:39  adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.62  1996/10/11 10:57:01  adam
+ * New module recctrl. Used to manage records (extract/retrieval).
+ * Several files have been moved to the recctrl sub directory.
+ *
+ * Revision 1.61  1996/06/06 12:08:37  quinn
+ * Added showRecord function
+ *
+ * Revision 1.60  1996/06/04  10:18:12  adam
+ * Search/scan uses character mapping module.
+ *
+ * Revision 1.59  1996/05/14  15:47:07  adam
+ * Cleanup of various buffer size entities.
+ *
+ * Revision 1.58  1996/05/14  06:16:38  adam
  * Compact use/set bytes used in search service.
  *
  * Revision 1.57  1996/05/13 14:23:04  adam
 #include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <ctype.h>
 
-#include <alexutil.h>
 #include <recctrl.h>
 #include "index.h"
 
@@ -252,6 +266,8 @@ static void logRecord (int showFlag)
 
 void key_open (int mem)
 {
+    if (!mem)
+        mem = atoi(res_get_def (common_resource, "memMax", "4"))*1024*1024;
     if (mem < 50000)
         mem = 50000;
     key_buf = xmalloc (mem);
@@ -276,7 +292,7 @@ void key_open (int mem)
 struct encode_info {
     int  sysno;
     int  seqno;
-    char buf[512];
+    char buf[768];
 };
 
 void encode_key_init (struct encode_info *i)
@@ -346,7 +362,7 @@ void key_flush (void)
     key_file_no++;
     logf (LOG_LOG, "sorting section %d", key_file_no);
     qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
-    sprintf (out_fname, TEMP_FNAME, key_file_no);
+    getFnameTmp (out_fname, key_file_no);
 
     if (!(outf = fopen (out_fname, "w")))
     {
@@ -479,13 +495,11 @@ static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys,
     short attrUse = -1;
     int off = 0;
 
-#if 1
     if (zebTargetInfo_curDatabase (zti, databaseName))
     {
         if (zebTargetInfo_newDatabase (zti, databaseName))
             abort ();
     }
-#endif
     while (off < reckeys->buf_used)
     {
         const char *src = reckeys->buf + off;
@@ -508,18 +522,14 @@ static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys,
             key_flush ();
         ++ptr_i;
         key_buf[ptr_top-ptr_i] = (char*)key_buf + key_buf_used;
-#if 1
+
         lead = zebTargetInfo_lookupSU (zti, attrSet, attrUse);
         if (lead < 0)
             lead = zebTargetInfo_addSU (zti, attrSet, attrUse);
         assert (lead > 0);
         ((char*) key_buf) [key_buf_used++] = lead;
-#else
-        key_buf_used += index_word_prefix ((char*)key_buf + key_buf_used,
-                                           attrSet, attrUse, databaseName);
-#endif
         while (*src)
-            ((char*)key_buf) [key_buf_used++] = index_char_cvt (*src++);
+            ((char*)key_buf) [key_buf_used++] = *src++;
         src++;
         ((char*)key_buf) [key_buf_used++] = '\0';
         
@@ -850,6 +860,8 @@ static int recordExtract (SYSNO *sysno, const char *fname,
         extractCtrl.readf = file_read;
         extractCtrl.seekf = file_seek;
         extractCtrl.endf = file_end;
+        extractCtrl.map_chrs_input = map_chrs_input;
+        extractCtrl.flagShowRecords = rGroup->flagShowRecords;
         r = (*recType->extract)(&extractCtrl);
 
         if (r)