# Copyright (C) 1995-1996, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.40 1996-10-11 10:56:58 adam Exp $
+# $Id: Makefile,v 1.41 1996-10-29 14:09:36 adam Exp $
SHELL=/bin/sh
RANLIB=ranlib
DEFS=$(INCLUDE)
O1 = main.o dir.o dirs.o trav.o extract.o kinput.o kcompare.o \
symtab.o recindex.o recstat.o lockutil.o lockidx.o \
- zinfo.o invstat.o keychars.o
+ zinfo.o invstat.o keychars.o
O2 = kdump.o
O3 = zserver.o kcompare.o zrpn.o zsets.o attribute.o recindex.o \
zlogs.o lockutil.o locksrv.o zinfo.o keychars.o
all: $(TPROG1) $(TPROG2) $(TPROG3)
-$(TPROG1): $(O1) ../lib/dict.a ../lib/isam.a ../lib/recctrl.a \
- ../lib/bfile.a ../lib/dfa.a ../lib/alexutil.a
+$(TPROG1): $(O1) ../lib/dict.a ../lib/isam.a ../lib/isamc.a ../lib/recctrl.a \
+ ../lib/bfile.a ../lib/dfa.a ../lib/zebrautl.a
$(CC) $(CFLAGS) -o $(TPROG1) $(O1) \
- ../lib/dict.a ../lib/isam.a ../lib/recctrl.a \
- ../lib/bfile.a ../lib/dfa.a ../lib/alexutil.a \
+ ../lib/dict.a ../lib/isam.a ../lib/isamc.a ../lib/recctrl.a \
+ ../lib/bfile.a ../lib/dfa.a ../lib/zebrautl.a \
$(YAZLIB)
$(TPROG2): $(O2)
- $(CC) $(CFLAGS) -o $(TPROG2) $(O2) ../lib/alexutil.a $(YAZLIB)
+ $(CC) $(CFLAGS) -o $(TPROG2) $(O2) ../lib/zebrautl.a $(YAZLIB)
$(TPROG3): $(O3) \
../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/recctrl.a \
- ../lib/bfile.a ../lib/dfa.a ../lib/alexutil.a
+ ../lib/isamc.a ../lib/bfile.a ../lib/dfa.a ../lib/zebrautl.a
$(CC) $(CFLAGS) -o $(TPROG3) $(O3) \
../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/recctrl.a \
- ../lib/bfile.a ../lib/dfa.a ../lib/alexutil.a \
+ ../lib/isamc.a ../lib/bfile.a ../lib/dfa.a ../lib/zebrautl.a \
$(YAZLIB) $(OSILIB) $(NETLIB) -lm
.c.o:
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.62 1996-10-11 10:57:01 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.
*
#include <unistd.h>
#include <fcntl.h>
-#include <alexutil.h>
#include <recctrl.h>
#include "index.h"
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);
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")))
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.44 1996-06-06 12:08:40 quinn
+ * Revision 1.45 1996-10-29 14:09:42 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.44 1996/06/06 12:08:40 quinn
* Added showRecord function
*
* Revision 1.43 1996/06/04 10:18:12 adam
* New simple file index tool.
*
*/
-
#include <time.h>
#include <zebraver.h>
-#include <alexutil.h>
+#include <zebrautl.h>
+
#include <dict.h>
#include <isam.h>
+#include <isamc.h>
#define IT_MAX_WORD 256
#define IT_KEY_HAVE_SEQNO 1
#define IT_KEY_HAVE_FIELD 0
+typedef int SYSNO;
+
struct it_key {
int sysno;
- int seqno;
+ int seqno;
};
enum dirsKind { dirs_dir, dirs_file };
int fileVerboseFlag;
};
+void getFnameTmp (char *fname, int no);
struct dirs_info *dirs_open (Dict dict, const char *rep);
struct dirs_info *dirs_fopen (Dict dict, const char *path);
void key_open (int mem);
int key_close (void);
-void key_write (int cmd, struct it_key *k, const char *str);
int key_compare (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 (const char *dict_fname, const char *isam_fname);
-void key_input (const char *dict_fname, const char *isam_fname,
- int nkeys, int cache);
+void key_input (int nkeys, int cache);
+ISAMC_M key_isamc_m (void);
int merge_sort (char **buf, int from, int to);
-#define TEMP_FNAME "keys%d.tmp"
-#define FNAME_WORD_DICT "worddict"
-#define FNAME_WORD_ISAM "wordisam"
+#define FNAME_DICT "dict"
+#define FNAME_ISAM "isam"
+#define FNAME_ISAMC "isamc"
#define FNAME_CONFIG "zebra.cfg"
#define GMATCH_DICT "gmatch"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kcompare.c,v $
- * Revision 1.17 1996-06-04 10:18:58 adam
+ * Revision 1.18 1996-10-29 14:09:44 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.17 1996/06/04 10:18:58 adam
* Minor changes - removed include of ctype.h.
*
* Revision 1.16 1996/05/13 14:23:05 adam
return cp1[l] - cp2[l];
}
+struct iscz_code_info {
+ struct it_key key;
+};
+
+static void *iscz_code_start (int mode)
+{
+ struct iscz_code_info *p = xmalloc (sizeof(*p));
+ p->key.sysno = 0;
+ p->key.seqno = 0;
+ return p;
+}
+
+static void iscz_code_stop (int mode, void *p)
+{
+ xfree (p);
+}
+
+void iscz_encode_int (unsigned d, char **dst)
+{
+ unsigned char *bp = (unsigned char*) *dst;
+
+ if (d <= 63)
+ *bp++ = d;
+ else if (d <= 16383)
+ {
+ *bp++ = 64 + (d>>8);
+ *bp++ = d & 255;
+ }
+ else if (d <= 4194303)
+ {
+ *bp++ = 128 + (d>>16);
+ *bp++ = (d>>8) & 255;
+ *bp++ = d & 255;
+ }
+ else
+ {
+ *bp++ = 192 + (d>>24);
+ *bp++ = (d>>16) & 255;
+ *bp++ = (d>>8) & 255;
+ *bp++ = d & 255;
+ }
+ *dst = (char *) bp;
+}
+
+int isxz_decode_int (unsigned char **src)
+{
+ unsigned c = *(*src)++;
+ switch (c & 192)
+ {
+ case 0:
+ return c;
+ case 64:
+ return ((c & 63) << 8) + *(*src)++;
+ case 128:
+ c = ((c & 63) << 8) + *(*src)++;
+ c = (c << 8) + *(*src)++;
+ return c;
+ }
+ c = ((c & 63) << 8) + *(*src)++;
+ c = (c << 8) + *(*src)++;
+ c = (c << 8) + *(*src)++;
+ return c;
+}
+
+static void iscz_code_item (int mode, void *vp, char **dst, char **src)
+{
+ struct iscz_code_info *p = vp;
+ struct it_key tkey;
+ int d;
+
+ if (mode == ISAMC_ENCODE)
+ {
+ memcpy (&tkey, *src, sizeof(struct it_key));
+ d = tkey.sysno - p->key.sysno;
+ iscz_encode_int (d, dst);
+ if (d)
+ {
+ p->key.sysno = tkey.sysno;
+ p->key.seqno = 0;
+ }
+ iscz_encode_int (tkey.seqno - p->key.seqno, dst);
+ p->key.seqno = tkey.seqno;
+ (*src) += sizeof(struct it_key);
+ }
+ else
+ {
+ d = isxz_decode_int ((unsigned char **) src);
+ if (d)
+ {
+ p->key.sysno += d;
+ p->key.seqno = 0;
+ }
+ d = isxz_decode_int ((unsigned char **) src);
+ p->key.seqno += d;
+ memcpy (*dst, &p->key, sizeof(struct it_key));
+ (*dst) += sizeof(struct it_key);
+ }
+}
+
+ISAMC_M key_isamc_m (void)
+{
+ static ISAMC_M me = NULL;
+
+ if (me)
+ return me;
+
+ me = isc_getmethod ();
+
+ me->compare_item = key_compare;
+
+ me->code_start = iscz_code_start;
+ me->code_item = iscz_code_item;
+ me->code_stop = iscz_code_stop;
+
+ me->debug = atoi(res_get_def (common_resource, "isamcDebug", "0"));
+
+ logf (LOG_LOG, "ISAMC system active");
+ return me;
+}
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kinput.c,v $
- * Revision 1.18 1996-06-04 10:18:59 adam
+ * Revision 1.19 1996-10-29 14:09:46 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.18 1996/06/04 10:18:59 adam
* Minor changes - removed include of ctype.h.
*
* Revision 1.17 1996/05/14 15:47:07 adam
void getFnameTmp (char *fname, int no)
{
- sprintf (fname, TEMP_FNAME, no);
+ const char *pre;
+
+ pre = res_get_def (common_resource, "keyTmpDir", ".");
+ sprintf (fname, "%s/key%d.tmp", pre, no);
}
void key_file_chunk_read (struct key_file *f)
int heapnum;
int *ptr;
int (*cmp)(const void *p1, const void *p2);
+ Dict dict;
+ ISAM isam;
+ ISAMC isamc;
};
struct heap_info *key_heap_init (int nkeys,
return 1;
}
-int heap_inp (Dict dict, ISAM isam, struct heap_info *hi)
+struct heap_cread_info {
+ char prev_name[INP_NAME_MAX];
+ char cur_name[INP_NAME_MAX];
+ char *key;
+ struct heap_info *hi;
+ int mode;
+ int more;
+};
+
+int heap_cread_item (void *vp, char **dst, int *insertMode)
+{
+ struct heap_cread_info *p = vp;
+ struct heap_info *hi = p->hi;
+
+ if (p->mode == 1)
+ {
+ *insertMode = p->key[0];
+ memcpy (*dst, p->key+1, sizeof(struct it_key));
+ (*dst) += sizeof(struct it_key);
+ p->mode = 2;
+ return 1;
+ }
+ strcpy (p->prev_name, p->cur_name);
+ if (!(p->more = heap_read_one (hi, p->cur_name, p->key)))
+ return 0;
+ if (*p->cur_name && strcmp (p->cur_name, p->prev_name))
+ {
+ p->mode = 1;
+ return 0;
+ }
+ *insertMode = p->key[0];
+ memcpy (*dst, p->key+1, sizeof(struct it_key));
+ (*dst) += sizeof(struct it_key);
+ return 1;
+}
+
+int heap_inpc (struct heap_info *hi)
+{
+ struct heap_cread_info hci;
+ ISAMC_P isamc_p;
+ ISAMC_I isamc_i = xmalloc (sizeof(*isamc_i));
+ void *dict_info;
+
+ hci.key = xmalloc (KEY_SIZE);
+ hci.mode = 1;
+ hci.hi = hi;
+ hci.more = heap_read_one (hi, hci.cur_name, hci.key);
+
+ isamc_i->clientData = &hci;
+ isamc_i->read_item = heap_cread_item;
+
+ while (hci.more)
+ {
+ logf (LOG_DEBUG, "inserting %s", 1+hci.cur_name);
+ if ((dict_info = dict_lookup (hi->dict, hci.cur_name)))
+ {
+ logf (LOG_FATAL, "Cannot merge really yet! %s", hci.cur_name);
+ exit (1);
+ }
+ else
+ {
+ char this_name[128];
+ strcpy (this_name, hci.cur_name);
+ isamc_p = isc_merge (hi->isamc, 0, isamc_i);
+ no_insertions++;
+ dict_insert (hi->dict, this_name, sizeof(ISAMC_P), &isamc_p);
+ }
+ }
+ xfree (isamc_i);
+ return 0;
+}
+
+int heap_inp (struct heap_info *hi)
{
char *info;
char next_name[INP_NAME_MAX];
no_diffs++;
nmemb = key_buf_ptr / KEY_SIZE;
assert (nmemb*KEY_SIZE == key_buf_ptr);
- if ((info = dict_lookup (dict, cur_name)))
+ if ((info = dict_lookup (hi->dict, cur_name)))
{
ISAM_P isam_p, isam_p2;
- logf (LOG_DEBUG, "updating %s", cur_name);
+ logf (LOG_DEBUG, "updating %s", 1+cur_name);
memcpy (&isam_p, info+1, sizeof(ISAM_P));
- isam_p2 = is_merge (isam, isam_p, nmemb, key_buf);
+ isam_p2 = is_merge (hi->isam, isam_p, nmemb, key_buf);
if (!isam_p2)
{
no_deletions++;
- if (!dict_delete (dict, cur_name))
+ if (!dict_delete (hi->dict, cur_name))
abort ();
}
else
{
no_updates++;
if (isam_p2 != isam_p)
- dict_insert (dict, cur_name, sizeof(ISAM_P), &isam_p2);
+ dict_insert (hi->dict, cur_name, sizeof(ISAM_P), &isam_p2);
}
}
else
{
ISAM_P isam_p;
- logf (LOG_DEBUG, "inserting %s", cur_name);
+ logf (LOG_DEBUG, "inserting %s", 1+cur_name);
no_insertions++;
- isam_p = is_merge (isam, 0, nmemb, key_buf);
- dict_insert (dict, cur_name, sizeof(ISAM_P), &isam_p);
+ isam_p = is_merge (hi->isam, 0, nmemb, key_buf);
+ dict_insert (hi->dict, cur_name, sizeof(ISAM_P), &isam_p);
}
memcpy (key_buf, next_key, KEY_SIZE);
strcpy (cur_name, next_name);
p->totalOffset += keyp->buf_size;
}
-void key_input (const char *dict_fname, const char *isam_fname,
- int nkeys, int cache)
+void key_input (int nkeys, int cache)
{
Dict dict;
- ISAM isam;
+ ISAM isam = NULL;
+ ISAMC isamc = NULL;
struct key_file **kf;
char rbuf[1024];
int i, r;
if (!nkeys)
return ;
}
- dict = dict_open (dict_fname, cache, 1);
+ dict = dict_open (FNAME_DICT, cache, 1);
if (!dict)
{
- logf (LOG_FATAL, "dict_open fail of `%s'", dict_fname);
+ logf (LOG_FATAL, "dict_open fail");
exit (1);
}
- isam = is_open (isam_fname, key_compare, 1, sizeof(struct it_key));
- if (!isam)
+ if (res_get_match (common_resource, "isam", "c", NULL))
{
- logf (LOG_FATAL, "is_open fail of `%s'", isam_fname);
- exit (1);
+ isamc = isc_open (FNAME_ISAMC, 1, key_isamc_m ());
+ if (!isamc)
+ {
+ logf (LOG_FATAL, "isc_open fail");
+ exit (1);
+ }
+ }
+ else
+ {
+ isam = is_open (FNAME_ISAM, key_compare, 1, sizeof(struct it_key));
+ if (!isam)
+ {
+ logf (LOG_FATAL, "is_open fail");
+ exit (1);
+ }
}
-
kf = xmalloc ((1+nkeys) * sizeof(*kf));
progressInfo.totalBytes = 0;
progressInfo.totalOffset = 0;
progressInfo.totalOffset += kf[i]->buf_size;
}
hi = key_heap_init (nkeys, key_qsort_compare);
+ hi->dict = dict;
+ hi->isam = isam;
+ hi->isamc = isamc;
+
for (i = 1; i<=nkeys; i++)
if ((r = key_file_read (kf[i], rbuf)))
key_heap_insert (hi, rbuf, r, kf[i]);
- heap_inp (dict, isam, hi);
-
+ if (isamc)
+ heap_inpc (hi);
+ else
+ heap_inp (hi);
dict_close (dict);
- is_close (isam);
+ if (isam)
+ is_close (isam);
+ if (isamc)
+ isc_close (isamc);
for (i = 1; i<=nkeys; i++)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: main.c,v $
- * Revision 1.43 1996-06-06 12:08:42 quinn
+ * Revision 1.44 1996-10-29 14:09:48 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.43 1996/06/06 12:08:42 quinn
* Added showRecord function
*
* Revision 1.42 1996/05/31 09:07:01 quinn
#include <assert.h>
#include <unistd.h>
-#include <alexutil.h>
#include <data1.h>
#include "index.h"
char *prog;
-size_t mem_max = 4*1024*1024;
-extern char *data1_tabpath;
+size_t mem_max = 0;
static void abort_func (int level, const char *msg, void *info)
{
configName);
exit (1);
}
- data1_tabpath = res_get (common_resource, "profilePath");
- bf_lockDir (res_get (common_resource, "lockPath"));
+ data1_set_tabpath (res_get (common_resource,
+ "profilePath"));
+ bf_lockDir (res_get (common_resource, "lockDir"));
init_charmap();
}
if (!strcmp (arg, "update"))
zebraIndexLockMsg ("r");
}
rec_prstat ();
- inv_prstat (FNAME_WORD_DICT, FNAME_WORD_ISAM);
+ inv_prstat (FNAME_DICT, FNAME_ISAM);
}
else
{
if (nsections)
{
logf (LOG_LOG, "Merging with index");
- key_input (FNAME_WORD_DICT, FNAME_WORD_ISAM, nsections,
- 60);
+ key_input (nsections, 60);
sync ();
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.53 1996-06-26 09:21:43 adam
+ * Revision 1.54 1996-10-29 14:09:52 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.53 1996/06/26 09:21:43 adam
* Bug fix: local attribute set wasn't obeyed in scan.
*
* Revision 1.52 1996/06/17 14:26:20 adam
#include <charmap.h>
#include <rsisam.h>
+#include <rsisamc.h>
#include <rstemp.h>
#include <rsnull.h>
#include <rsbool.h>
Z_AttributesPlusTerm *zapt;
} AttrType;
+static RSET rset_create_isamx (ZServerInfo *zi, int pos)
+{
+ if (zi->isam)
+ {
+ rset_isam_parms parms;
+
+ parms.pos = pos;
+ parms.is = zi->isam;
+ return rset_create (rset_kind_isam, &parms);
+ }
+ if (zi->isamc)
+ {
+ rset_isamc_parms parms;
+
+ parms.pos = pos;
+ parms.is = zi->isamc;
+ return rset_create (rset_kind_isamc, &parms);
+ }
+ return rset_create (rset_kind_null, NULL);
+}
+
static int attr_find (AttrType *src, oid_value *attributeSetP)
{
while (src->major < src->zapt->num_attributes)
static RSET rset_trunc (ISAM isam, ISAM_P *isam_p, int no)
{
-
+ assert (isam);
qsort (isam_p, no, sizeof(*isam_p), isam_trunc_cmp);
return rset_trunc_r (isam, isam_p, 0, no, 100);
}
return 0;
}
logf (LOG_DEBUG, "dict_lookup_grep: %s", term_dict);
- r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, max_pos,
+ r = dict_lookup_grep (zi->dict, term_dict, 0, grep_info, max_pos,
0, grep_handle);
if (r)
logf (LOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r);
for (i = 0; term_sub[i]; i++)
verbatim_char (term_sub[i], &j, term_dict);
strcpy (term_dict+j, ")");
- r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ r = dict_lookup_grep (zi->dict, term_dict, 0, grep_info,
&max_pos, 0, grep_handle);
if (r)
logf (LOG_WARN, "dict_lookup_grep err, trunc=none:%d", r);
for (i = 0; term_sub[i]; i++)
verbatim_char (term_sub[i], &j, term_dict);
strcpy (term_dict+j, ".*)");
- dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ dict_lookup_grep (zi->dict, term_dict, 0, grep_info,
&max_pos, 0, grep_handle);
break;
case 2: /* left truncation */
else
verbatim_char (term_sub[i], &j, term_dict);
strcpy (term_dict+j, ")");
- r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ r = dict_lookup_grep (zi->dict, term_dict, 0, grep_info,
&max_pos, 0, grep_handle);
if (r)
logf (LOG_WARN, "dict_lookup_grep err, trunc=#: %d",
break;
case 102: /* regular expression */
sprintf (term_dict + j, "(%s)", term_sub);
- r = dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info,
+ r = dict_lookup_grep (zi->dict, term_dict, 0, grep_info,
&max_pos, 0, grep_handle);
if (r)
logf (LOG_WARN, "dict_lookup_grep err, trunc=regular: %d",
cp += 2;
}
sprintf (term_dict + j, "(%s)", cp);
- r = dict_lookup_grep (zi->wordDict, term_dict, r, grep_info,
+ r = dict_lookup_grep (zi->dict, term_dict, r, grep_info,
&max_pos, j, grep_handle);
if (r)
logf (LOG_WARN, "dict_lookup_grep err, trunc=eregular: %d",
parms.key_size = sizeof(struct it_key);
parms.max_rec = 100;
parms.cmp = key_compare;
- parms.is = zi->wordIsam;
+ parms.is = zi->isam;
parms.no_terms = 0;
if (zapt->term->which != Z_Term_general)
oid_value attributeSet,
int num_bases, char **basenames)
{
- rset_isam_parms parms;
char termz[IT_MAX_WORD+1];
struct grep_info grep_info;
RSET result;
result = rset_create (rset_kind_null, NULL);
else if (grep_info.isam_p_indx == 1)
{
- parms.is = zi->wordIsam;
- parms.pos = *grep_info.isam_p_buf;
- result = rset_create (rset_kind_isam, &parms);
+ result = rset_create_isamx (zi, *grep_info.isam_p_buf);
}
else
- result = rset_trunc (zi->wordIsam, grep_info.isam_p_buf,
+ result = rset_trunc (zi->isam, grep_info.isam_p_buf,
grep_info.isam_p_indx);
#ifdef TERM_COUNT
xfree(grep_info.term_no);
if (grep_info.isam_p_indx == 0)
rset[rset_no] = rset_create (rset_kind_null, NULL);
else if (grep_info.isam_p_indx > 1)
- rset[rset_no] = rset_trunc (zi->wordIsam,
+ rset[rset_no] = rset_trunc (zi->isam,
grep_info.isam_p_buf,
grep_info.isam_p_indx);
else
{
- rset_isam_parms parms;
-
- parms.is = zi->wordIsam;
- parms.pos = *grep_info.isam_p_buf;
- rset[rset_no] = rset_create (rset_kind_isam, &parms);
+ rset[rset_no] = rset_create_isamx (zi, *grep_info.isam_p_buf);
}
assert (rset[rset_no]);
if (++rset_no >= sizeof(rset)/sizeof(*rset))
rfd = rset_open (*r, RSETF_READ|RSETF_SORT_SYSNO);
while (rset_read (*r, rfd, &key))
{
+ logf (LOG_DEBUG, "sysno=%-7d seqno=%d", key.sysno, key.seqno);
if (key.sysno != psysno)
{
rset_write (w, wfd, &key);
oident *attrset;
oid_value attributeSet;
- dict_grep_cmap (zi->wordDict, map_chrs_input);
+ dict_grep_cmap (zi->dict, map_chrs_input);
zlog_rpn (rpn);
zi->errCode = 0;
trans_scan_term (zi, zapt, termz+prefix_len);
- dict_scan (zi->wordDict, termz, &before_tmp, &after_tmp, scan_info,
+ dict_scan (zi->dict, termz, &before_tmp, &after_tmp, scan_info,
scan_handle);
}
glist = odr_malloc (zi->odr, (before+after)*sizeof(*glist));
const char *mterm = NULL;
const char *tst;
RSET rset;
- rset_isam_parms parms;
for (j = 0; j < ord_no; j++)
{
if (j0 == -1)
break;
scan_term_untrans (zi->odr, &glist[i+before].term, mterm);
- parms.is = zi->wordIsam;
- parms.pos = scan_info_array[j0].list[ptr[j0]].isam_p;
- rset = rset_create (rset_kind_isam, &parms);
+ rset =
+ rset_create_isamx (zi, scan_info_array[j0].list[ptr[j0]].isam_p);
ptr[j0]++;
for (j = j0+1; j<ord_no; j++)
(tst=scan_info_array[j].list[ptr[j]].term) &&
!strcmp (tst, mterm))
{
- rset_isam_parms parms;
rset_bool_parms bool_parms;
RSET rset2;
- parms.is = zi->wordIsam;
- parms.pos = scan_info_array[j].list[ptr[j]].isam_p;
- rset2 = rset_create (rset_kind_isam, &parms);
+ rset2 = rset_create_isamx
+ (zi, scan_info_array[j].list[ptr[j]].isam_p);
bool_parms.key_size = sizeof(struct it_key);
bool_parms.cmp = key_compare;
const char *mterm = NULL;
const char *tst;
RSET rset;
- rset_isam_parms parms;
for (j = 0; j <ord_no; j++)
{
scan_term_untrans (zi->odr, &glist[before-1-i].term, mterm);
- parms.is = zi->wordIsam;
- parms.pos = scan_info_array[j0].list[before-1-ptr[j0]].isam_p;
- rset = rset_create (rset_kind_isam, &parms);
+ rset = rset_create_isamx
+ (zi, scan_info_array[j0].list[before-1-ptr[j0]].isam_p);
ptr[j0]++;
(tst=scan_info_array[j].list[before-1-ptr[j]].term) &&
!strcmp (tst, mterm))
{
- rset_isam_parms parms;
rset_bool_parms bool_parms;
RSET rset2;
- parms.is = zi->wordIsam;
- parms.pos = scan_info_array[j].list[before-1-ptr[j]].isam_p;
- rset2 = rset_create (rset_kind_isam, &parms);
+ rset2 = rset_create_isamx (zi,
+ scan_info_array[j].list[before-1-ptr[j]].isam_p);
bool_parms.key_size = sizeof(struct it_key);
bool_parms.cmp = key_compare;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.40 1996-06-04 10:19:02 adam
+ * Revision 1.41 1996-10-29 14:09:56 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.40 1996/06/04 10:19:02 adam
* Minor changes - removed include of ctype.h.
*
* Revision 1.39 1996/05/31 09:07:05 quinn
if (zi->records)
{
zebTargetInfo_close (zi->zti, 0);
- dict_close (zi->wordDict);
- is_close (zi->wordIsam);
+ dict_close (zi->dict);
+ if (zi->isam)
+ is_close (zi->isam);
+ if (zi->isamc)
+ isc_close (zi->isamc);
rec_close (&zi->records);
}
bf_cache (state);
zi->registerState = state;
zi->records = rec_open (0);
- if (!(zi->wordDict = dict_open (FNAME_WORD_DICT, 40, 0)))
+ if (!(zi->dict = dict_open (FNAME_DICT, 40, 0)))
return -1;
- if (!(zi->wordIsam = is_open (FNAME_WORD_ISAM, key_compare, 0,
+ zi->isam = NULL;
+ zi->isamc = NULL;
+ if (res_get_match (common_resource, "isam", "c", NULL))
+ {
+ if (!(zi->isamc = isc_open (FNAME_ISAMC, 0, key_isamc_m())))
+ return -1;
+
+ }
+ else
+ {
+ if (!(zi->isam = is_open (FNAME_ISAM, key_compare, 0,
sizeof (struct it_key))))
- return -1;
+ return -1;
+ }
zi->zti = zebTargetInfo_open (zi->records, 0);
init_charmap ();
return 0;
logf (LOG_FATAL, "Cannot open resource `%s'", sob->configname);
exit (1);
}
- bf_lockDir (res_get (common_resource, "lockPath"));
- data1_tabpath = res_get(common_resource, "profilePath");
+ bf_lockDir (res_get (common_resource, "lockDir"));
+ data1_set_tabpath (res_get(common_resource, "profilePath"));
}
server_info.sets = NULL;
server_info.registerState = -1; /* trigger open of registers! */
server_info.registerChange = 0;
server_info.records = NULL;
- server_info.wordDict = NULL;
- server_info.wordIsam = NULL;
server_info.odr = odr_createmem (ODR_ENCODE);
return &r;
}
{
if (server_info.records)
{
- dict_close (server_info.wordDict);
- is_close (server_info.wordIsam);
+ dict_close (server_info.dict);
+ if (server_info.isam)
+ is_close (server_info.isam);
+ if (server_info.isamc)
+ isc_close (server_info.isamc);
rec_close (&server_info.records);
register_unlock (&server_info);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.20 1996-06-04 10:19:02 adam
+ * Revision 1.21 1996-10-29 14:09:58 adam
+ * Use of cisam system - enabled if setting isamc is 1.
+ *
+ * Revision 1.20 1996/06/04 10:19:02 adam
* Minor changes - removed include of ctype.h.
*
* Revision 1.19 1996/05/14 11:34:01 adam
int registerState; /* 0 (no commit pages), 1 (use commit pages) */
time_t registerChange;
ZServerSet *sets;
- Dict wordDict;
- ISAM wordIsam;
+ Dict dict;
+ ISAM isam;
+ ISAMC isamc;
Records records;
int errCode;
char *errString;