+static void writeAttributeValueDetails (ZebraExplainInfo zei,
+ zebAttributeDetails zad,
+ data1_node *node_atvs, data1_attset *attset)
+
+{
+ struct zebSUInfoB *zsui;
+ int set_ordinal = attset->reference;
+ data1_attset_child *c;
+
+ for (c = attset->children; c; c = c->next)
+ writeAttributeValueDetails (zei, zad, node_atvs, c->child);
+ for (zsui = zad->SUInfo; zsui; zsui = zsui->next)
+ {
+ data1_node *node_attvalue, *node_value;
+ if (set_ordinal != zsui->info.set)
+ continue;
+ node_attvalue = data1_mk_tag (zei->dh, zei->nmem, "attributeValue",
+ 0 /* attr */, node_atvs);
+ node_value = data1_mk_tag (zei->dh, zei->nmem, "value",
+ 0 /* attr */, node_attvalue);
+ data1_mk_tag_data_int (zei->dh, node_value, "numeric",
+ zsui->info.use, zei->nmem);
+ }
+}
+
+static void zebraExplain_writeCategoryList (ZebraExplainInfo zei,
+ struct zebraCategoryListInfo *zcl,
+ int key_flush)
+{
+ char *sgml_buf;
+ int sgml_len;
+ int i;
+ Record drec;
+ data1_node *node_ci, *node_categoryList;
+ SYSNO sysno = 0;
+ static char *category[] = {
+ "CategoryList",
+ "TargetInfo",
+ "DatabaseInfo",
+ "AttributeDetails",
+ NULL
+ };
+
+ assert (zcl);
+ if (!zcl->dirty)
+ return ;
+ zcl->dirty = 1;
+ node_categoryList = zcl->data1_categoryList;
+
+#if ZINFO_DEBUG
+ yaz_log (YLOG_LOG, "zebraExplain_writeCategoryList");
+#endif
+
+ drec = createRecord (zei->records, &sysno);
+
+ node_ci = data1_search_tag (zei->dh, node_categoryList,
+ "/categoryList");
+ assert (node_ci);
+ node_ci = data1_mk_tag (zei->dh, zei->nmem, "categories", 0 /* attr */,
+ node_ci);
+ assert (node_ci);
+
+ for (i = 0; category[i]; i++)
+ {
+ data1_node *node_cat = data1_mk_tag (zei->dh, zei->nmem, "category",
+ 0 /* attr */, node_ci);
+
+ data1_mk_tag_data_text (zei->dh, node_cat, "name",
+ category[i], zei->nmem);
+ }
+ /* extract *searchable* keys from it. We do this here, because
+ record count, etc. is affected */
+ if (key_flush)
+ (*zei->updateFunc)(zei->updateHandle, drec, node_categoryList);
+
+ /* convert to "SGML" and write it */
+#if ZINFO_DEBUG
+ data1_pr_tree (zei->dh, node_categoryList, stderr);
+#endif
+ sgml_buf = data1_nodetoidsgml(zei->dh, node_categoryList, 0, &sgml_len);
+ drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
+ memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len);
+ drec->size[recInfo_storeData] = sgml_len;
+
+ rec_put (zei->records, &drec);
+}
+
+static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei,
+ zebAttributeDetails zad,
+ const char *databaseName,
+ int key_flush)