From d8728143be0a28eb22a93d91c4ba7d3ab6c3f6cb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 28 Sep 1995 12:10:31 +0000 Subject: [PATCH] Bug fixes. Field prefix used in queries. --- index/extract.c | 15 ++++++++------- index/index.h | 10 +++++++--- index/kcompare.c | 11 ++++++++++- index/zrpn.c | 20 +++++++++++++------- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/index/extract.c b/index/extract.c index 9b7f76b..a7169f1 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.10 1995-09-28 09:19:41 adam + * Revision 1.11 1995-09-28 12:10:31 adam + * Bug fixes. Field prefix used in queries. + * + * Revision 1.10 1995/09/28 09:19:41 adam * xfree/xmalloc used everywhere. * Extract/retrieve method seems to work for text records. * @@ -128,7 +131,7 @@ void wordFlush (int sysno) static void wordInit (RecWord *p) { p->attrSet = 1; - p->attrUse = 1; + p->attrUse = 1016; p->which = Word_String; } @@ -137,7 +140,6 @@ static void wordAdd (const RecWord *p) struct it_key key; char x; size_t i; - char wordPrefix[8]; if (key_offset + 1000 > key_buf_size) { @@ -149,9 +151,8 @@ static void wordAdd (const RecWord *p) xfree (key_buf); key_buf = new_key_buf; } - sprintf (wordPrefix, "%c%04d", p->attrSet + '0', p->attrUse); - strcpy (key_buf + key_offset, wordPrefix); - key_offset += strlen (wordPrefix); + key_offset += index_word_prefix (key_buf + key_offset, + p->attrSet, p->attrUse); switch (p->which) { case Word_String: @@ -167,7 +168,7 @@ static void wordAdd (const RecWord *p) key_offset++; key.sysno = key_sysno; - key.seqno = p->seqno; + key.seqno = p->seqno; memcpy (key_buf + key_offset, &key, sizeof(key)); key_offset += sizeof(key); } diff --git a/index/index.h b/index/index.h index 2ebdb61..5352205 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.11 1995-09-27 12:22:28 adam + * Revision 1.12 1995-09-28 12:10:32 adam + * Bug fixes. Field prefix used in queries. + * + * Revision 1.11 1995/09/27 12:22:28 adam * More work on extract in record control. * Field name is not in isam keys but in prefix in dictionary words. * @@ -51,8 +54,8 @@ #define IT_KEY_HAVE_FIELD 0 struct it_key { - int sysno; - short seqno; + int sysno : 24; + int seqno : 16; }; struct dir_entry { @@ -87,3 +90,4 @@ void strtab_del (struct strtab *t, void (*func)(const char *name, void *info, void *data), void *data); int index_char_cvt (int c); +int index_word_prefix (char *string, int attrSet, int attrUse); diff --git a/index/kcompare.c b/index/kcompare.c index d326493..5ffab21 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.8 1995-09-28 09:19:42 adam + * Revision 1.9 1995-09-28 12:10:32 adam + * Bug fixes. Field prefix used in queries. + * + * Revision 1.8 1995/09/28 09:19:42 adam * xfree/xmalloc used everywhere. * Extract/retrieve method seems to work for text records. * @@ -87,3 +90,9 @@ int index_char_cvt (int c) { return tolower (c); } + +int index_word_prefix (char *string, int attrSet, int attrUse) +{ + sprintf (string, "%c%04d", attrSet + '0', attrUse); + return 5; +} diff --git a/index/zrpn.c b/index/zrpn.c index 744f3dc..ec7b8a3 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.13 1995-09-18 14:17:50 adam + * Revision 1.14 1995-09-28 12:10:32 adam + * Bug fixes. Field prefix used in queries. + * + * Revision 1.13 1995/09/18 14:17:50 adam * Minor changes. * * Revision 1.12 1995/09/15 14:45:21 adam @@ -395,10 +398,11 @@ static RSET rpn_search_APT_relevance (ZServerInfo *zi, zi->errCode = 124; return NULL; } - sizez = term->u.general->len; + i = index_word_prefix (termz, 1, 1016); + sizez = i + term->u.general->len; if (sizez > IT_MAX_WORD) sizez = IT_MAX_WORD; - for (i = 0; iu.general->buf[i]); termz[i] = '\0'; @@ -440,10 +444,11 @@ static RSET rpn_search_APT_word (ZServerInfo *zi, zi->errCode = 124; return NULL; } - sizez = term->u.general->len; + i = index_word_prefix (termz, 1, 1016); + sizez = i + term->u.general->len; if (sizez > IT_MAX_WORD) sizez = IT_MAX_WORD; - for (i = 0; iu.general->buf[i]); termz[i] = '\0'; @@ -477,10 +482,11 @@ static RSET rpn_search_APT_phrase (ZServerInfo *zi, zi->errCode = 124; return NULL; } - sizez = term->u.general->len; + i = index_word_prefix (termz, 1, 1016); + sizez = i + term->u.general->len; if (sizez > IT_MAX_WORD) sizez = IT_MAX_WORD; - for (i = 0; iu.general->buf[i]); termz[i] = '\0'; -- 1.7.10.4