Remote record import using Z39.50 Extended Services and Segments.
+Fixed bug where updating a database with user-defined attributes
+could corrupt the register (bad storeKeys).
+
Multi-threaded version.
Fixed bug regarding proximity.
Zebra TODO
-$Id: TODO,v 1.9 2000-07-07 12:49:20 adam Exp $
+$Id: TODO,v 1.10 2000-12-05 10:01:44 adam Exp $
+
+Explain category Attributedetails should include name/description
+of search- attrribute.
+
+String indexing/search (possibly including XPATH-like queres)
+
+Null-value search.
+
+Handle XML empty node constructs <tag/>
Browse set.
-## $Id: Makefile.am,v 1.4 2000-10-17 12:37:09 adam Exp $
+## $Id: Makefile.am,v 1.5 2000-12-05 10:01:44 adam Exp $
-noinst_PROGRAMS = apitest
+noinst_PROGRAMS = apitest kdump
if ISZMBOL
bin_PROGRAMS = zmbolidx zmbolsrv
retrieve.c kinput.c \
index.h recindex.h recindxp.h zebraapi.h zinfo.h zserver.h
+kdump_SOURCES=kdump.c kcompare.c
+
INCLUDES = -I$(srcdir)/../include $(YAZINC) $(TCL_INCLUDE)
if ISZMBOL
YAZVERSION = @YAZVERSION@
yazconfig = @yazconfig@
-noinst_PROGRAMS = apitest
+noinst_PROGRAMS = apitest kdump
@ISZMBOL_TRUE@bin_PROGRAMS = zmbolidx zmbolsrv
@ISZMBOL_FALSE@bin_PROGRAMS = zebraidx zebrasrv
@ISZMBOL_TRUE@zmbolidx_SOURCES = main.c dir.c dirs.c trav.c extract.c kinput.c kcompare.c symtab.c recindex.c recstat.c lockutil.c lockidx.c zinfo.c invstat.c sortidx.c compact.c index.h recindex.h recindxp.h zebraapi.h zinfo.h zserver.h
apitest_SOURCES = apitest.c kcompare.c zrpn.c zsets.c attribute.c recindex.c lockutil.c locksrv.c zinfo.c trunc.c sortidx.c rank1.c zebraapi.c retrieve.c kinput.c index.h recindex.h recindxp.h zebraapi.h zinfo.h zserver.h
+kdump_SOURCES = kdump.c kcompare.c
+
INCLUDES = -I$(srcdir)/../include $(YAZINC) $(TCL_INCLUDE)
@ISZMBOL_TRUE@zmbol_libs = ../isam/libisam.a ../isamc/libisamc.a ../isamb/libisamb.a
@ISZMBOL_FALSE@zmbol_libs =
@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \
@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a
apitest_LDFLAGS =
+kdump_OBJECTS = kdump.o kcompare.o
+kdump_LDADD = $(LDADD)
+@ISZMBOL_FALSE@kdump_DEPENDENCIES = ../rset/librset.a ../dict/libdict.a \
+@ISZMBOL_FALSE@../isams/libisams.a ../recctrl/librecctrl.a \
+@ISZMBOL_FALSE@../bfile/libbfile.a ../dfa/libdfa.a ../util/libutil.a
+@ISZMBOL_TRUE@kdump_DEPENDENCIES = ../rset/librset.a ../dict/libdict.a \
+@ISZMBOL_TRUE@../isams/libisams.a ../isam/libisam.a ../isamc/libisamc.a \
+@ISZMBOL_TRUE@../isamb/libisamb.a ../recctrl/librecctrl.a \
+@ISZMBOL_TRUE@../bfile/libbfile.a ../dfa/libdfa.a ../util/libutil.a
+kdump_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
GZIP_ENV = --best
DEP_FILES = .deps/apitest.P .deps/attribute.P .deps/compact.P \
.deps/dir.P .deps/dirs.P .deps/extract.P .deps/invstat.P \
-.deps/kcompare.P .deps/kinput.P .deps/lockidx.P .deps/locksrv.P \
-.deps/lockutil.P .deps/main.P .deps/rank1.P .deps/recindex.P \
-.deps/recstat.P .deps/retrieve.P .deps/sortidx.P .deps/symtab.P \
-.deps/trav.P .deps/trunc.P .deps/zebraapi.P .deps/zinfo.P .deps/zrpn.P \
-.deps/zserver.P .deps/zsets.P
-SOURCES = $(zmbolidx_SOURCES) $(zmbolsrv_SOURCES) $(zebraidx_SOURCES) $(zebrasrv_SOURCES) $(apitest_SOURCES)
-OBJECTS = $(zmbolidx_OBJECTS) $(zmbolsrv_OBJECTS) $(zebraidx_OBJECTS) $(zebrasrv_OBJECTS) $(apitest_OBJECTS)
+.deps/kcompare.P .deps/kdump.P .deps/kinput.P .deps/lockidx.P \
+.deps/locksrv.P .deps/lockutil.P .deps/main.P .deps/rank1.P \
+.deps/recindex.P .deps/recstat.P .deps/retrieve.P .deps/sortidx.P \
+.deps/symtab.P .deps/trav.P .deps/trunc.P .deps/zebraapi.P \
+.deps/zinfo.P .deps/zrpn.P .deps/zserver.P .deps/zsets.P
+SOURCES = $(zmbolidx_SOURCES) $(zmbolsrv_SOURCES) $(zebraidx_SOURCES) $(zebrasrv_SOURCES) $(apitest_SOURCES) $(kdump_SOURCES)
+OBJECTS = $(zmbolidx_OBJECTS) $(zmbolsrv_OBJECTS) $(zebraidx_OBJECTS) $(zebrasrv_OBJECTS) $(apitest_OBJECTS) $(kdump_OBJECTS)
all: all-redirect
.SUFFIXES:
@rm -f apitest
$(LINK) $(apitest_LDFLAGS) $(apitest_OBJECTS) $(apitest_LDADD) $(LIBS)
+kdump: $(kdump_OBJECTS) $(kdump_DEPENDENCIES)
+ @rm -f kdump
+ $(LINK) $(kdump_LDFLAGS) $(kdump_OBJECTS) $(kdump_LDADD) $(LIBS)
+
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
/*
- * Copyright (C) 1994-1999, Index Data
+ * Copyright (C) 1994-2000, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.104 2000-09-05 14:04:05 adam
+ * Revision 1.105 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.104 2000/09/05 14:04:05 adam
* Updates for prefix 'yaz_' for YAZ log functions.
*
* Revision 1.103 2000/05/18 12:01:36 adam
static ZebraExplainInfo zti = NULL;
+
static void logRecord (int showFlag)
{
if (!showFlag)
*dst++ = lead;
+#if SU_SCHEME
+ if ((lead & 3) < 3)
+ {
+ int ch = zebraExplain_lookupSU (zti, attrSet, attrUse);
+ if (ch < 0)
+ {
+ ch = zebraExplain_addSU (zti, attrSet, attrUse);
+ yaz_log (LOG_LOG, "addSU set=%d use=%d SU=%d",
+ attrSet, attrUse, ch);
+ }
+ assert (ch > 0);
+ memcpy (dst, &ch, sizeof(ch));
+ dst += sizeof(ch);
+ }
+#else
if (!(lead & 1))
{
memcpy (dst, &attrSet, sizeof(attrSet));
memcpy (dst, &attrUse, sizeof(attrUse));
dst += sizeof(attrUse);
}
+#endif
*dst++ = p->reg_type;
memcpy (dst, string, length);
dst += length;
static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys)
{
+#if SU_SCHEME
+#else
unsigned char attrSet = (unsigned char) -1;
unsigned short attrUse = (unsigned short) -1;
+#endif
int seqno = 0;
int off = 0;
+ int ch = 0;
zebraExplain_recordCountIncrement (zti, cmd ? 1 : -1);
while (off < reckeys->buf_used)
{
const char *src = reckeys->buf + off;
struct it_key key;
- int lead, ch;
+ int lead;
lead = *src++;
+#if SU_SCHEME
+ if ((lead & 3) < 3)
+ {
+ memcpy (&ch, src, sizeof(ch));
+ src += sizeof(ch);
+ }
+#else
if (!(lead & 1))
{
memcpy (&attrSet, src, sizeof(attrSet));
memcpy (&attrUse, src, sizeof(attrUse));
src += sizeof(attrUse);
}
+#endif
if (key_buf_used + 1024 > (ptr_top-ptr_i)*sizeof(char*))
key_flush ();
++ptr_i;
+
key_buf[ptr_top-ptr_i] = (char*)key_buf + key_buf_used;
+#if SU_SCHEME
+#else
ch = zebraExplain_lookupSU (zti, attrSet, attrUse);
if (ch < 0)
+ {
ch = zebraExplain_addSU (zti, attrSet, attrUse);
+ yaz_log (LOG_LOG, "addSU cmd=%d set=%d use=%d SU=%d",
+ cmd, attrSet, attrUse, ch);
+ }
+#endif
assert (ch > 0);
key_buf_used += key_SU_code (ch, ((char*)key_buf) + key_buf_used);
int off = 0;
int startSeq = -1;
int i;
+ int seqno = 0;
+#if SU_SCHEME
+ int chS, ch;
+#else
short attrUse;
char attrSet;
- int seqno = 0;
+#endif
for (i = 0; i<32; i++)
ws[i] = NULL;
-
+
+#if SU_SCHEME
+ chS = zebraExplain_lookupSU (zti, attrSetS, attrUseS);
+ if (chS < 0)
+ return ws;
+#endif
while (off < reckeys->buf_used)
{
int lead;
lead = *src++;
-
+#if SU_SCHEME
+ if ((lead & 3)<3)
+ {
+ memcpy (&ch, src, sizeof(ch));
+ src += sizeof(ch);
+ }
+#else
if (!(lead & 1))
{
memcpy (&attrSet, src, sizeof(attrSet));
memcpy (&attrUse, src, sizeof(attrUse));
src += sizeof(attrUse);
}
+#endif
wstart = src;
while (*src++)
;
memcpy (&seqno, src, sizeof(seqno));
src += sizeof(seqno);
}
- if (attrUseS == attrUse && attrSetS == attrSet)
+ if (
+#if SU_SCHEME
+ ch == chS
+#else
+ attrUseS == attrUse && attrSetS == attrSet
+#endif
+ )
{
int woff;
/*
- * Copyright (C) 1995-1999, Index Data
+ * Copyright (C) 1995-0000, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss, Heikki Levanto
* (log at the end)
YAZ_BEGIN_CDECL
+#define SU_SCHEME 1
+
#define IT_MAX_WORD 256
#define IT_KEY_HAVE_SEQNO 1
#define IT_KEY_HAVE_FIELD 0
#endif
/*
* $Log: index.h,v $
- * Revision 1.69 2000-03-20 19:08:36 adam
+ * Revision 1.70 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.69 2000/03/20 19:08:36 adam
* Added remote record import using Z39.50 extended services and Segment
* Requests.
*
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kdump.c,v $
- * Revision 1.18 1999-09-07 07:19:21 adam
+ * Revision 1.19 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.18 1999/09/07 07:19:21 adam
* Work on character mapping. Implemented replace rules.
*
* Revision 1.17 1999/02/02 14:50:55 adam
}
else if (ret == 'v')
{
- log_init (log_mask_str(arg), prog, NULL);
+ yaz_log_init (yaz_log_mask_str(arg), prog, NULL);
}
else if (ret == 'c')
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindxp.h,v $
- * Revision 1.8 2000-04-05 09:49:35 adam
+ * Revision 1.9 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.8 2000/04/05 09:49:35 adam
* On Unix, zebra/z'mbol uses automake.
*
* Revision 1.7 1999/07/06 12:28:04 adam
#define REC_BLOCK_TYPES 2
#define REC_HEAD_MAGIC "recindex"
-#define REC_VERSION 1
+#define REC_VERSION 2
struct records_info {
int rw;
* All rights reserved.
*
* $Log: zebraapi.c,v $
- * Revision 1.41 2000-12-01 17:59:08 adam
+ * Revision 1.42 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.41 2000/12/01 17:59:08 adam
* Fixed bug regarding online updates on WIN32.
* When zebra.cfg is not available the server will not abort.
*
int diff = 0;
int *pseqno = &p->seqnos[p->reg_type];
ZebraHandle zh = p->extractCtrl->handle;
+ ZebraExplainInfo zei = zh->service->zei;
struct recKeys *keys = &zh->keys;
if (keys->buf_used+1024 > keys->buf_max)
*dst++ = lead;
+#if SU_SCHEME
+ if ((lead & 3) < 3)
+ {
+ int ch = zebraExplain_lookupSU (zei, attrSet, attrUse);
+ if (ch < 0)
+ {
+ ch = zebraExplain_addSU (zei, attrSet, attrUse);
+ yaz_log (LOG_LOG, "addSU set=%d use=%d SU=%d",
+ attrSet, attrUse, ch);
+ }
+ assert (ch > 0);
+ memcpy (dst, &ch, sizeof(ch));
+ dst += sizeof(ch);
+ }
+#else
if (!(lead & 1))
{
memcpy (dst, &attrSet, sizeof(attrSet));
memcpy (dst, &attrUse, sizeof(attrUse));
dst += sizeof(attrUse);
}
+#endif
*dst++ = p->reg_type;
memcpy (dst, string, length);
dst += length;
static void extract_flushRecordKeys (ZebraHandle zh, SYSNO sysno,
int cmd, struct recKeys *reckeys)
{
+#if SU_SCHEME
+#else
unsigned char attrSet = (unsigned char) -1;
unsigned short attrUse = (unsigned short) -1;
+#endif
int seqno = 0;
int off = 0;
+ int ch = 0;
ZebraExplainInfo zei = zh->service->zei;
if (!zh->key_buf)
{
const char *src = reckeys->buf + off;
struct it_key key;
- int lead, ch;
+ int lead;
lead = *src++;
+#if SU_SCHEME
+ if ((lead & 3) < 3)
+ {
+ memcpy (&ch, src, sizeof(ch));
+ src += sizeof(ch);
+ }
+#else
if (!(lead & 1))
{
memcpy (&attrSet, src, sizeof(attrSet));
memcpy (&attrUse, src, sizeof(attrUse));
src += sizeof(attrUse);
}
+#endif
if (zh->key_buf_used + 1024 > (zh->ptr_top-zh->ptr_i)*sizeof(char*))
extract_flushWriteKeys (zh);
++(zh->ptr_i);
(zh->key_buf)[zh->ptr_top - zh->ptr_i] =
(char*)zh->key_buf + zh->key_buf_used;
-
+#if SU_SCHEME
+#else
ch = zebraExplain_lookupSU (zei, attrSet, attrUse);
if (ch < 0)
ch = zebraExplain_addSU (zei, attrSet, attrUse);
+#endif
assert (ch > 0);
zh->key_buf_used +=
key_SU_code (ch,((char*)zh->key_buf) + zh->key_buf_used);
/*
- * Copyright (C) 1994-1999, Index Data
+ * Copyright (C) 1994-2000, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zinfo.c,v $
- * Revision 1.20 2000-11-29 14:24:01 adam
+ * Revision 1.21 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.20 2000/11/29 14:24:01 adam
* Script configure uses yaz pthreads options. Added locking for
* zebra_register_{lock,unlock}.
*
{
zdi->recordCount = atoi_n (np->child->u.data.data,
np->child->u.data.len);
- }
+ }
zdi->readFlag = 0;
rec_rm (&rec);
}
/*
- * Copyright (C) 1994-1999, Index Data
+ * Copyright (C) 1994-2000, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recgrs.c,v $
- * Revision 1.35 2000-11-29 15:21:31 adam
+ * Revision 1.36 2000-12-05 10:01:44 adam
+ * Fixed bug regarding user-defined attribute sets.
+ *
+ * Revision 1.35 2000/11/29 15:21:31 adam
* Fixed problem with passwd db.
*
* Revision 1.34 2000/02/25 13:24:49 adam
nmem_destroy (mem);
return 0;
}
+#if 0
data1_pr_tree (p->dh, node, stdout);
+#endif
logf (LOG_DEBUG, "grs_retrieve: size");
if ((dnew = data1_insert_taggeddata(p->dh, node, node,
"size", mem)))