+ run_icu(s, icu_chain_id, value, facet_wrbuf, display_wrbuf);
+}
+
+struct facet_id {
+ char *client_id;
+ char *type;
+ char *id;
+ char *term;
+ struct facet_id *next;
+};
+
+static void session_add_id_facet(struct session *s, struct client *cl,
+ const char *type,
+ const char *id,
+ size_t id_len,
+ const char *term)
+{
+ struct facet_id *t = nmem_malloc(s->session_nmem, sizeof(*t));
+
+ t->client_id = nmem_strdup(s->session_nmem, client_get_id(cl));
+ t->type = nmem_strdup(s->session_nmem, type);
+ t->id = nmem_strdupn(s->session_nmem, id, id_len);
+ t->term = nmem_strdup(s->session_nmem, term);
+ t->next = s->facet_id_list;
+ s->facet_id_list = t;
+}
+
+
+// Look up a facet term, and return matching id
+// If facet type not found, returns 0
+// If facet type found, but no matching term, returns ""
+const char *session_lookup_id_facet(struct session *s, struct client *cl,
+ const char *type,
+ const char *term)
+{
+ char *retval = 0;
+ struct facet_id *t = s->facet_id_list;
+ for (; t; t = t->next)