From: Adam Dickmeiss Date: Tue, 9 Mar 1999 16:27:49 +0000 (+0000) Subject: More work on SDRKit integration. X-Git-Tag: ZEBRA.1.0~122 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=9252c3f4231f9f3226326ce1360f055bad48b8d1;p=idzebra-moved-to-github.git More work on SDRKit integration. --- diff --git a/dict/dcompact.c b/dict/dcompact.c index 6dd4165..88fd6ba 100644 --- a/dict/dcompact.c +++ b/dict/dcompact.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: dcompact.c,v $ - * Revision 1.1 1999-03-09 13:07:06 adam + * Revision 1.2 1999-03-09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.1 1999/03/09 13:07:06 adam * Work on dict_compact routine. * */ @@ -26,7 +29,7 @@ int dict_compact (BFiles bfs, const char *from_name, const char *to_name) if (!from) return -1; map = xmalloc ((from->head.last+1) * sizeof(*map)); - for (i = 0; i <= from->head.last; i++) + for (i = 0; i <= (int) (from->head.last); i++) map[i] = -1; to = dict_open (bfs, to_name, 0, 1); if (!to) @@ -34,7 +37,7 @@ int dict_compact (BFiles bfs, const char *from_name, const char *to_name) map[0] = 0; map[1] = DICT_pagesize(from); - for (i = 1; i < from->head.last; i++) + for (i = 1; i < (int) (from->head.last); i++) { void *buf; logf (LOG_LOG, "map[%d] = %d", i, map[i]); diff --git a/index/extract.c b/index/extract.c index d9c619b..3e29b83 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.91 1999-02-12 13:29:22 adam + * Revision 1.92 1999-03-09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.91 1999/02/12 13:29:22 adam * Implemented position-flag for registers. * * Revision 1.90 1999/02/02 14:50:52 adam @@ -1634,14 +1637,17 @@ int fileExtract (SYSNO *sysno, const char *fname, rGroup->flagStoreKeys = 0; #if ZEBRASDR - if (1) + if (rGroup->useSDR) { ZebraSdrHandle h; char xname[128], *xp; strncpy (xname, fname, 127); - if ((xp = strchr (xname, '.'))) - *xp = '\0'; + if (!(xp = strchr (xname, '.'))) + return 0; + *xp = '\0'; + if (strcmp (xp+1, "sdr.bits")) + return 0; h = zebraSdr_open (xname); if (!h) @@ -1657,9 +1663,8 @@ int fileExtract (SYSNO *sysno, const char *fname, segmentno = zebraSdr_segment (h, 0); sprintf (sdr_name, "%%%s.%d", xname, segmentno); - logf (LOG_LOG, "SDR: %s", sdr_name); -#if 1 +#if 0 if (segmentno > 20) break; #endif diff --git a/index/index.h b/index/index.h index 2cf0f58..f4b59b7 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.60 1998-10-16 08:14:31 adam + * Revision 1.61 1999-03-09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.60 1998/10/16 08:14:31 adam * Updated record control system. * * Revision 1.59 1998/06/08 14:43:11 adam @@ -266,6 +269,9 @@ struct recordGroup { int fileVerboseLimit; int databaseNamePath; int explainDatabase; +#if ZEBRASDR + int useSDR; +#endif data1_handle dh; BFiles bfs; ZebraMaps zebra_maps; @@ -301,6 +307,7 @@ int key_compare_it (const void *p1, const void *p2); int key_qsort_compare (const void *p1, const void *p2); void key_logdump (int mask, const void *p); void inv_prstat (BFiles bfs); +void inv_compact (BFiles bfs); void key_input (BFiles bfs, int nkeys, int cache); ISAMC_M key_isamc_m (Res res); int merge_sort (char **buf, int from, int to); diff --git a/index/main.c b/index/main.c index 68e68a3..f4c52ad 100644 --- a/index/main.c +++ b/index/main.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: main.c,v $ - * Revision 1.62 1999-02-18 15:01:24 adam + * Revision 1.63 1999-03-09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.62 1999/02/18 15:01:24 adam * Minor changes. * * Revision 1.61 1999/02/02 14:51:00 adam @@ -269,6 +272,7 @@ int main (int argc, char **argv) #if ZEBRASDR zebraSdr_std (); + rGroupDef.useSDR = 0; #endif rGroupDef.groupName = NULL; rGroupDef.databaseName = NULL; @@ -307,11 +311,18 @@ int main (int argc, char **argv) " -v Set logging to .\n" " -l Write log to .\n" " -f Display information for the first records.\n" +#if ZEBRASDR + " -S Use SDRKit\n" +#endif " -V Show version.\n" ); exit (1); } - while ((ret = options ("sVt:c:g:d:m:v:nf:l:", argv, argc, &arg)) != -2) + while ((ret = options ("sVt:c:g:d:m:v:nf:l:" +#if ZEBRASDR + "S" +#endif + , argv, argc, &arg)) != -2) { if (ret == 0) { @@ -409,6 +420,18 @@ int main (int argc, char **argv) rec_close (&records); inv_prstat (rGroupDef.bfs); } + else if (!strcmp (arg, "compact")) + { + printf ("--------- compact ------\n"); + rval = res_get (common_resource, "shadow"); + zebraIndexLock (rGroupDef.bfs, 0, rval); + if (rval && *rval) + { + bf_cache (rGroupDef.bfs, rval); + zebraIndexLockMsg ("r"); + } + inv_compact(rGroupDef.bfs); + } else { logf (LOG_FATAL, "unknown command: %s", arg); @@ -489,7 +512,13 @@ int main (int argc, char **argv) } else if (ret == 'V') { - fprintf (stderr, "Zebra %s %s\n", ZEBRAVER, ZEBRADATE); + fprintf (stderr, "Zebra %s %s\n", +#if ZEBRASDR + "SDR", +#else + ZEBRAVER, +#endif + ZEBRADATE); } else if (ret == 'v') log_init_level (log_mask_str(arg)); @@ -511,6 +540,10 @@ int main (int argc, char **argv) rGroupDef.recordType = arg; else if (ret == 'n') disableCommit = 1; +#if ZEBRASDR + else if (ret == 'S') + rGroupDef.useSDR = 1; +#endif else logf (LOG_WARN, "unknown option '-%s'", arg); } diff --git a/index/retrieve.c b/index/retrieve.c index dcc17b9..5e2ed20 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: retrieve.c,v $ - * Revision 1.7 1999-03-02 16:15:43 quinn + * Revision 1.8 1999-03-09 16:27:49 adam + * More work on SDRKit integration. + * + * Revision 1.7 1999/03/02 16:15:43 quinn * Added "tagsysno" and "tagrank" directives to zebra.cfg. * * Revision 1.6 1999/02/18 15:01:25 adam @@ -193,12 +196,12 @@ int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream, recordAttr->recordOffset); if (fc.record_int_len > 180) { - logf (LOG_LOG, "%0.70s", fc.record_int_buf); - logf (LOG_LOG, "%0.70s", fc.record_int_buf + + logf (LOG_LOG, "%.70s", fc.record_int_buf); + logf (LOG_LOG, "%.70s", fc.record_int_buf + (fc.record_int_len - 70)); } else - logf (LOG_LOG, "%0.*s", + logf (LOG_LOG, "%.*s", fc.record_int_len, fc.record_int_buf); /* the following two lines makes rec_rm delete buf */ diff --git a/zebra.dsp b/zebra.dsp index db93c77..97963b5 100644 --- a/zebra.dsp +++ b/zebra.dsp @@ -104,10 +104,18 @@ SOURCE=.\bfile\commit.c # End Source File # Begin Source File +SOURCE=.\index\compact.c +# End Source File +# Begin Source File + SOURCE=.\dict\dclose.c # End Source File # Begin Source File +SOURCE=.\dict\dcompact.c +# End Source File +# Begin Source File + SOURCE=.\dict\delete.c # End Source File # Begin Source File