-/* $Id: zinfo.c,v 1.55 2006-02-20 12:41:42 adam Exp $
+/* $Id: zinfo.c,v 1.57 2006-03-30 09:52:15 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
if (*sysno)
{
rec = rec_get(records, *sysno);
+ if (!rec)
+ return 0;
xfree(rec->info[recInfo_storeData]);
}
else
{
rec = rec_new(records);
+ if (!rec)
+ return 0;
*sysno = rec->sysno;
rec->info[recInfo_fileType] =
/* 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_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);
-
}
+
zebraExplain_newDatabase(zei, "IR-Explain-1", 0);
if (!zei->categoryList->dirty)
#endif
drec = createRecord (zei->records, &sysno);
+ if (!drec)
+ return;
node_ci = data1_search_tag (zei->dh, node_categoryList,
"/categoryList");
#endif
drec = createRecord (zei->records, &zad->sysno);
+ if (!drec)
+ return;
assert (zad->data1_tree);
node_adinfo = data1_search_tag (zei->dh, zad->data1_tree,
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,
#endif
drec = createRecord (zei->records, &o->sysno);
+ if (!drec)
+ return;
node_root =
data1_read_sgml (zei->dh, zei->nmem,
"<explain><attributeSetInfo>AttributeSetInfo\n"
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;
+
+ 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)
{
struct zebSUInfoB *zsui;
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;