projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added support for specification of approximative limits for whole query.
[idzebra-moved-to-github.git]
/
index
/
zinfo.c
diff --git
a/index/zinfo.c
b/index/zinfo.c
index
669f366
..
267d164
100644
(file)
--- a/
index/zinfo.c
+++ b/
index/zinfo.c
@@
-1,4
+1,4
@@
-/* $Id: zinfo.c,v 1.69 2006-09-15 10:45:13 adam Exp $
+/* $Id: zinfo.c,v 1.75 2006-11-27 10:40:33 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
Copyright (C) 1995-2006
Index Data ApS
@@
-53,7
+53,7
@@
struct zebSUInfoB {
typedef struct zebAccessObjectB *zebAccessObject;
struct zebAccessObjectB {
void *handle;
typedef struct zebAccessObjectB *zebAccessObject;
struct zebAccessObjectB {
void *handle;
- SYSNO sysno;
+ zint sysno;
Odr_oid *oid;
zebAccessObject next;
};
Odr_oid *oid;
zebAccessObject next;
};
@@
-66,7
+66,7
@@
struct zebAccessInfoB {
typedef struct {
struct zebSUInfoB *SUInfo;
typedef struct {
struct zebSUInfoB *SUInfo;
- SYSNO sysno;
+ zint sysno;
int dirty;
int readFlag;
data1_node *data1_tree;
int dirty;
int readFlag;
data1_node *data1_tree;
@@
-79,7
+79,7
@@
struct zebDatabaseInfoB {
data1_node *data1_database;
zint recordCount; /* records in db */
zint recordBytes; /* size of records */
data1_node *data1_database;
zint recordCount; /* records in db */
zint recordBytes; /* size of records */
- SYSNO sysno; /* sysno of database info */
+ zint sysno; /* sysno of database info */
int readFlag; /* 1: read is needed when referenced; 0 if not */
int dirty; /* 1: database is dirty: write is needed */
struct zebDatabaseInfoB *next;
int readFlag; /* 1: read is needed when referenced; 0 if not */
int dirty; /* 1: database is dirty: write is needed */
struct zebDatabaseInfoB *next;
@@
-94,7
+94,7
@@
struct zebraExplainAttset {
struct zebraCategoryListInfo {
int dirty;
struct zebraCategoryListInfo {
int dirty;
- SYSNO sysno;
+ zint sysno;
data1_node *data1_categoryList;
};
data1_node *data1_categoryList;
};
@@
-143,7
+143,7
@@
static void zebraExplain_writeCategoryList(ZebraExplainInfo zei,
int key_flush);
int key_flush);
-static Record createRecord(Records records, SYSNO *sysno)
+static Record createRecord(Records records, zint *sysno)
{
Record rec;
if (*sysno)
{
Record rec;
if (*sysno)
@@
-855,8
+855,7
@@
static void zebraExplain_updateAccessInfo (ZebraExplainInfo zei, data1_node *n,
if (!c)
{
data1_pr_tree (zei->dh, n, stdout);
if (!c)
{
data1_pr_tree (zei->dh, n, stdout);
- exit (0);
- assert (c);
+ zebra_exit("zebraExplain_updateAccessInfo");
}
if ((p = accessInfo->attributeSetIds))
}
if ((p = accessInfo->attributeSetIds))
@@
-964,6
+963,8
@@
int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database,
zebraExplain_initCommonInfo (zei, node_adinfo);
zebraExplain_initCommonInfo (zei, node_adinfo);
+ data1_mk_tag_data_text(zei->dh, node_adinfo, "name", database, zei->nmem);
+
return 0;
}
return 0;
}
@@
-977,7
+978,7
@@
static void zebraExplain_writeCategoryList (ZebraExplainInfo zei,
int i;
Record drec;
data1_node *node_ci, *node_categoryList;
int i;
Record drec;
data1_node *node_ci, *node_categoryList;
- SYSNO sysno = 0;
+ zint sysno = 0;
static char *category[] = {
"CategoryList",
"TargetInfo",
static char *category[] = {
"CategoryList",
"TargetInfo",
@@
-1049,6
+1050,7
@@
static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei,
zad->dirty = 0;
#if ZINFO_DEBUG
yaz_log(YLOG_LOG, "zebraExplain_writeAttributeDetails");
zad->dirty = 0;
#if ZINFO_DEBUG
yaz_log(YLOG_LOG, "zebraExplain_writeAttributeDetails");
+ data1_pr_tree(zei->dh, zad->data1_tree, stderr);
#endif
drec = createRecord (zei->records, &zad->sysno);
#endif
drec = createRecord (zei->records, &zad->sysno);
@@
-1060,16
+1062,14
@@
static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei,
"/attributeDetails");
zebraExplain_updateCommonInfo (zei, node_adinfo);
"/attributeDetails");
zebraExplain_updateCommonInfo (zei, node_adinfo);
- data1_mk_tag_data_text (zei->dh, node_adinfo, "name",
- databaseName, zei->nmem);
+ /* zebra info (private) .. no children yet.. so se don't index zebraInfo */
+ node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
+ "zebraInfo", node_adinfo);
/* extract *searchable* keys from it. We do this here, because
record count, etc. is affected */
if (key_flush)
(*zei->updateFunc)(zei->updateHandle, drec, zad->data1_tree);
/* extract *searchable* keys from it. We do this here, because
record count, etc. is affected */
if (key_flush)
(*zei->updateFunc)(zei->updateHandle, drec, zad->data1_tree);
- /* zebra info (private) */
- node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
- "zebraInfo", node_adinfo);
node_list = data1_mk_tag_uni (zei->dh, zei->nmem,
"attrlist", node_zebra);
for (zsui = zad->SUInfo; zsui; zsui = zsui->next)
node_list = data1_mk_tag_uni (zei->dh, zei->nmem,
"attrlist", node_zebra);
for (zsui = zad->SUInfo; zsui; zsui = zsui->next)
@@
-1153,10
+1153,6
@@
static void zebraExplain_writeDatabase (ZebraExplainInfo zei,
zebraExplain_updateCommonInfo (zei, node_dbinfo);
zebraExplain_updateAccessInfo (zei, node_dbinfo, zdi->accessInfo);
zebraExplain_updateCommonInfo (zei, node_dbinfo);
zebraExplain_updateAccessInfo (zei, node_dbinfo, zdi->accessInfo);
- /* extract *searchable* keys from it. We do this here, because
- record count, etc. is affected */
- if (key_flush)
- (*zei->updateFunc)(zei->updateHandle, drec, zdi->data1_database);
/* record count */
node_count = data1_mk_tag_uni (zei->dh, zei->nmem,
"recordCount", node_dbinfo);
/* record count */
node_count = data1_mk_tag_uni (zei->dh, zei->nmem,
"recordCount", node_dbinfo);
@@
-1166,6
+1162,11
@@
static void zebraExplain_writeDatabase (ZebraExplainInfo zei,
/* zebra info (private) */
node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
"zebraInfo", node_dbinfo);
/* zebra info (private) */
node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
"zebraInfo", node_dbinfo);
+
+ /* extract *searchable* keys from it. We do this here, because
+ record count, etc. is affected */
+ if (key_flush)
+ (*zei->updateFunc)(zei->updateHandle, drec, zdi->data1_database);
data1_mk_tag_data_zint (zei->dh, node_zebra,
"recordBytes", zdi->recordBytes, zei->nmem);
data1_mk_tag_data_zint (zei->dh, node_zebra,
"recordBytes", zdi->recordBytes, zei->nmem);
@@
-1307,12
+1308,12
@@
static void zebraExplain_writeTarget (ZebraExplainInfo zei, int key_flush)
zebraExplain_updateCommonInfo (zei, node_tgtinfo);
zebraExplain_updateAccessInfo (zei, node_tgtinfo, zei->accessInfo);
zebraExplain_updateCommonInfo (zei, node_tgtinfo);
zebraExplain_updateAccessInfo (zei, node_tgtinfo, zei->accessInfo);
+ node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
+ "zebraInfo", node_tgtinfo);
/* convert to "SGML" and write it */
if (key_flush)
(*zei->updateFunc)(zei->updateHandle, trec, zei->data1_target);
/* convert to "SGML" and write it */
if (key_flush)
(*zei->updateFunc)(zei->updateHandle, trec, zei->data1_target);
- node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem,
- "zebraInfo", node_tgtinfo);
data1_mk_tag_data_text (zei->dh, node_zebra, "version",
ZEBRAVER, zei->nmem);
node_list = data1_mk_tag (zei->dh, zei->nmem,
data1_mk_tag_data_text (zei->dh, node_zebra, "version",
ZEBRAVER, zei->nmem);
node_list = data1_mk_tag (zei->dh, zei->nmem,
@@
-1360,10
+1361,10
@@
int zebraExplain_lookup_attr_str(ZebraExplainInfo zei,
assert (zei->curDatabaseInfo);
for (zsui = &zei->curDatabaseInfo->attributeDetails->SUInfo;
*zsui; zsui = &(*zsui)->next)
assert (zei->curDatabaseInfo);
for (zsui = &zei->curDatabaseInfo->attributeDetails->SUInfo;
*zsui; zsui = &(*zsui)->next)
- if ((*zsui)->info.index_type == index_type
- && (*zsui)->info.cat == cat
- && (*zsui)->info.which == ZEB_SU_STR
- && !yaz_matchstr((*zsui)->info.u.str, str))
+ if ( (index_type == -1 || (*zsui)->info.index_type == index_type)
+ && (*zsui)->info.cat == cat
+ && (*zsui)->info.which == ZEB_SU_STR
+ && !yaz_matchstr((*zsui)->info.u.str, str))
{
struct zebSUInfoB *zsui_this = *zsui;
{
struct zebSUInfoB *zsui_this = *zsui;
@@
-1612,6
+1613,8
@@
RecordAttr *rec_init_attr (ZebraExplainInfo zei, Record rec)
if (rec->info[recInfo_attr])
return (RecordAttr *) rec->info[recInfo_attr];
recordAttr = (RecordAttr *) xmalloc (sizeof(*recordAttr));
if (rec->info[recInfo_attr])
return (RecordAttr *) rec->info[recInfo_attr];
recordAttr = (RecordAttr *) xmalloc (sizeof(*recordAttr));
+
+ memset(recordAttr, '\0', sizeof(*recordAttr));
rec->info[recInfo_attr] = (char *) recordAttr;
rec->size[recInfo_attr] = sizeof(*recordAttr);
rec->info[recInfo_attr] = (char *) recordAttr;
rec->size[recInfo_attr] = sizeof(*recordAttr);