-/* $Id: extract.c,v 1.187 2005-06-23 06:45:46 adam Exp $
+/* $Id: extract.c,v 1.188 2005-08-05 10:40:13 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
w->section_id = 0;
}
-static const char **searchRecordKey (ZebraHandle zh,
- struct recKeys *reckeys,
- int attrSetS, int attrUseS)
+static void searchRecordKey(ZebraHandle zh,
+ const struct recKeys *reckeys,
+ int attrSetS, int attrUseS,
+ const char **ws, int ws_length)
{
- static const char *ws[32];
void *decode_handle = iscz1_start();
int off = 0;
int startSeq = -1;
int seqno = 0;
int i;
+ int ch;
- for (i = 0; i<32; i++)
+ for (i = 0; i<ws_length; i++)
ws[i] = NULL;
+ ch = zebraExplain_lookup_attr_su_any_index(zh->reg->zei,
+ attrSetS, attrUseS);
+ if (ch < 0)
+ return ;
+
while (off < reckeys->buf_used)
{
const char *src = reckeys->buf + off;
struct it_key key;
char *dst = (char*) &key;
- int attrSet, attrUse;
iscz1_decode(decode_handle, &dst, &src);
assert(key.len <= 4 && key.len > 2);
- attrSet = (int) key.mem[0] >> 16;
- attrUse = (int) key.mem[0] & 65535;
seqno = (int) key.mem[key.len-1];
- if (attrUseS == attrUse && attrSetS == attrSet)
+ if (key.mem[0] == ch)
{
int woff;
if (startSeq == -1)
startSeq = seqno;
woff = seqno - startSeq;
- if (woff >= 0 && woff < 31)
+ if (woff >= 0 && woff < ws_length)
ws[woff] = src;
}
}
iscz1_stop(decode_handle);
assert (off == reckeys->buf_used);
- return ws;
}
struct file_read_info {
static char dstBuf[2048]; /* static here ??? */
char *dst = dstBuf;
const char *s = spec;
- static const char **w;
while (1)
{
break;
if (*s == '(')
{
+ const char *ws[32];
char attset_str[64], attname_str[64];
data1_attset *attset;
int i;
else
attUse = atoi (attname_str);
}
- w = searchRecordKey (zh, reckeys, attSet, attUse);
- assert (w);
+ searchRecordKey (zh, reckeys, attSet, attUse, ws, 32);
if (*s == ')')
{
s++;
for (i = 0; i<32; i++)
- if (matchFlag[i] && w[i])
+ if (matchFlag[i] && ws[i])
{
if (first)
{
*dst++ = ' ';
first = 0;
}
- strcpy (dst, w[i]);
- dst += strlen(w[i]);
+ strcpy (dst, ws[i]);
+ dst += strlen(ws[i]);
}
if (first)
{
-/* $Id: zinfo.c,v 1.46 2005-06-23 06:45:46 adam Exp $
+/* $Id: zinfo.c,v 1.47 2005-08-05 10:40:13 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
rec_put (zei->records, &trec);
}
+int zebraExplain_lookup_attr_su_any_index(ZebraExplainInfo zei,
+ int set, int use)
+{
+ struct zebSUInfoB *zsui;
+
+ assert (zei->curDatabaseInfo);
+ for (zsui = zei->curDatabaseInfo->attributeDetails->SUInfo;
+ zsui; zsui=zsui->next)
+ if (zsui->info.which == ZEB_SU_SET_USE &&
+ zsui->info.u.su.use == use && zsui->info.u.su.set == set)
+ return zsui->info.ordinal;
+ return -1;
+}
+
int zebraExplain_lookup_attr_su(ZebraExplainInfo zei, int index_type,
int set, int use)
{
-/* $Id: zinfo.h,v 1.24 2005-06-23 06:45:46 adam Exp $
+/* $Id: zinfo.h,v 1.25 2005-08-05 10:40:13 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
int explain_database);
int zebraExplain_lookup_attr_su(ZebraExplainInfo zei, int index_type,
int set, int use);
+int zebraExplain_lookup_attr_su_any_index(ZebraExplainInfo zei,
+ int set, int use);
int zebraExplain_add_attr_su(ZebraExplainInfo zei, int index_type,
int set, int use);
int zebraExplain_lookup_attr_str(ZebraExplainInfo zei, int index_type,
-/* $Id: t6.c,v 1.9 2005-06-14 20:01:21 adam Exp $
+/* $Id: t6.c,v 1.10 2005-08-05 10:40:13 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
int main(int argc, char **argv)
{
int i;
- ZebraService zs = start_up(0, argc, argv);
+ ZebraService zs = start_up("zebra6.cfg", argc, argv);
ZebraHandle zh = zebra_open(zs);
srand(17);