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
By default, no searching for loadable modules is performed unless
[idzebra-moved-to-github.git]
/
index
/
zinfo.c
diff --git
a/index/zinfo.c
b/index/zinfo.c
index
740f7f0
..
a61dac1
100644
(file)
--- a/
index/zinfo.c
+++ b/
index/zinfo.c
@@
-1,4
+1,4
@@
-/* $Id: zinfo.c,v 1.54 2006-02-09 08:31:02 adam Exp $
+/* $Id: zinfo.c,v 1.57 2006-03-30 09:52:15 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-150,11
+150,15
@@
static Record createRecord(Records records, SYSNO *sysno)
if (*sysno)
{
rec = rec_get(records, *sysno);
if (*sysno)
{
rec = rec_get(records, *sysno);
+ if (!rec)
+ return 0;
xfree(rec->info[recInfo_storeData]);
}
else
{
rec = rec_new(records);
xfree(rec->info[recInfo_storeData]);
}
else
{
rec = rec_new(records);
+ if (!rec)
+ return 0;
*sysno = rec->sysno;
rec->info[recInfo_fileType] =
*sysno = rec->sysno;
rec->info[recInfo_fileType] =
@@
-520,6
+524,12
@@
ZebraExplainInfo zebraExplain_open(
/* write now because we want to be sure about the sysno */
trec = rec_new(records);
/* write now because we want to be sure about the sysno */
trec = rec_new(records);
+ if (!trec)
+ {
+ yaz_log(YLOG_FATAL, "Cannot create root Explain record");
+ nmem_destroy(zei->nmem);
+ return 0;
+ }
trec->info[recInfo_fileType] =
rec_strdup("grs.sgml", &trec->size[recInfo_fileType]);
trec->info[recInfo_databaseName] =
trec->info[recInfo_fileType] =
rec_strdup("grs.sgml", &trec->size[recInfo_fileType]);
trec->info[recInfo_databaseName] =
@@
-529,11
+539,11
@@
ZebraExplainInfo zebraExplain_open(
trec->info[recInfo_storeData] = (char *) xmalloc(sgml_len);
memcpy(trec->info[recInfo_storeData], sgml_buf, sgml_len);
trec->size[recInfo_storeData] = sgml_len;
trec->info[recInfo_storeData] = (char *) xmalloc(sgml_len);
memcpy(trec->info[recInfo_storeData], sgml_buf, sgml_len);
trec->size[recInfo_storeData] = sgml_len;
-
+
rec_put(records, &trec);
rec_rm(&trec);
rec_put(records, &trec);
rec_rm(&trec);
-
}
}
+
zebraExplain_newDatabase(zei, "IR-Explain-1", 0);
if (!zei->categoryList->dirty)
zebraExplain_newDatabase(zei, "IR-Explain-1", 0);
if (!zei->categoryList->dirty)
@@
-986,6
+996,8
@@
static void zebraExplain_writeCategoryList (ZebraExplainInfo zei,
#endif
drec = createRecord (zei->records, &sysno);
#endif
drec = createRecord (zei->records, &sysno);
+ if (!drec)
+ return;
node_ci = data1_search_tag (zei->dh, node_categoryList,
"/categoryList");
node_ci = data1_search_tag (zei->dh, node_categoryList,
"/categoryList");
@@
-1040,6
+1052,8
@@
static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei,
#endif
drec = createRecord (zei->records, &zad->sysno);
#endif
drec = createRecord (zei->records, &zad->sysno);
+ if (!drec)
+ return;
assert (zad->data1_tree);
node_adinfo = data1_search_tag (zei->dh, zad->data1_tree,
assert (zad->data1_tree);
node_adinfo = data1_search_tag (zei->dh, zad->data1_tree,
@@
-1182,6
+1196,8
@@
static void zebraExplain_writeDatabase (ZebraExplainInfo zei,
yaz_log(YLOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName);
#endif
drec = createRecord (zei->records, &zdi->sysno);
yaz_log(YLOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName);
#endif
drec = createRecord (zei->records, &zdi->sysno);
+ if (!drec)
+ return;
assert (zdi->data1_database);
node_dbinfo = data1_search_tag (zei->dh, zdi->data1_database,
assert (zdi->data1_database);
node_dbinfo = data1_search_tag (zei->dh, zdi->data1_database,
@@
-1272,6
+1288,8
@@
static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei,
#endif
drec = createRecord (zei->records, &o->sysno);
#endif
drec = createRecord (zei->records, &o->sysno);
+ if (!drec)
+ return;
node_root =
data1_read_sgml (zei->dh, zei->nmem,
"<explain><attributeSetInfo>AttributeSetInfo\n"
node_root =
data1_read_sgml (zei->dh, zei->nmem,
"<explain><attributeSetInfo>AttributeSetInfo\n"
@@
-1445,13
+1463,28
@@
int zebraExplain_trav_ord(ZebraExplainInfo zei, void *handle,
int zebraExplain_lookup_ord (ZebraExplainInfo zei, int ord,
int *index_type,
const char **db,
int zebraExplain_lookup_ord (ZebraExplainInfo zei, int ord,
int *index_type,
const char **db,
- int *set, int *use)
+ int *set, int *use,
+ const char **string_index)
{
struct zebDatabaseInfoB *zdb;
{
struct zebDatabaseInfoB *zdb;
+
+ if (set)
+ *set = -1;
+ if (use)
+ *use = -1;
+ if (index_type)
+ *index_type = 0;
+ if (string_index)
+ *string_index = 0;
+
for (zdb = zei->databaseInfo; zdb; zdb = zdb->next)
{
for (zdb = zei->databaseInfo; zdb; zdb = zdb->next)
{
- struct zebSUInfoB *zsui = zdb->attributeDetails->SUInfo;
- for ( ;zsui; zsui = zsui->next)
+ struct zebSUInfoB *zsui;
+
+ if (zdb->attributeDetails->readFlag)
+ zebraExplain_readAttributeDetails (zei, zdb->attributeDetails);
+
+ for (zsui = zdb->attributeDetails->SUInfo; zsui; zsui = zsui->next)
if (zsui->info.ordinal == ord)
{
if (db)
if (zsui->info.ordinal == ord)
{
if (db)
@@
-1463,6
+1496,11
@@
int zebraExplain_lookup_ord (ZebraExplainInfo zei, int ord,
if (use)
*use = zsui->info.u.su.use;
}
if (use)
*use = zsui->info.u.su.use;
}
+
+ if (zsui->info.which == ZEB_SU_STR)
+ if (string_index)
+ *string_index = zsui->info.u.str;
+
if (index_type)
*index_type = zsui->info.index_type;
return 0;
if (index_type)
*index_type = zsui->info.index_type;
return 0;