+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;
+ int 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
+ logf (LOG_LOG, "zebraExplain_writeCategoryList");
+#endif
+
+ drec = createRecord (zei->records, &sysno);
+
+ node_ci = data1_search_tag (zei->dh, node_categoryList->child,
+ "categoryList");
+ assert (node_ci);
+ node_ci = data1_add_tag (zei->dh, node_ci, "categories", zei->nmem);
+ assert (node_ci);
+
+ for (i = 0; category[i]; i++)
+ {
+ data1_node *node_cat = data1_add_tag (zei->dh, node_ci,
+ "category", zei->nmem);
+
+ data1_add_tagdata_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);
+}
+