{
WRBUF facet_wrbuf = wrbuf_alloc();
WRBUF display_wrbuf = wrbuf_alloc();
+ const char *id = 0;
+ size_t id_len = 0;
- session_normalize_facet(s, type, value, display_wrbuf, facet_wrbuf);
+ yaz_log(YLOG_LOG, "add_facet type=%s value=%s count=%d",
+ type, value, count);
+
+ /* inspect pz:facetmap:split:name ?? */
+ if (!strncmp(type, "split:", 6))
+ {
+ const char *cp = strchr(value, ':');
+ if (cp)
+ {
+ id = value;
+ id_len = cp - value;
+ value = cp + 1;
+ yaz_log(YLOG_LOG, "strip id=%s value=%s", id, value);
+ }
+ type += 6;
+ }
+ session_normalize_facet(s, type, value, display_wrbuf, facet_wrbuf);
if (wrbuf_len(facet_wrbuf))
{
struct named_termlist **tp = &s->termlists;
(*tp)->next = 0;
}
termlist_insert((*tp)->termlist, wrbuf_cstr(display_wrbuf),
- wrbuf_cstr(facet_wrbuf), count);
+ wrbuf_cstr(facet_wrbuf), id, id_len, count);
}
wrbuf_destroy(facet_wrbuf);
wrbuf_destroy(display_wrbuf);
wrbuf_puts(c->wrbuf, "<name>");
wrbuf_xmlputs(c->wrbuf, p[i]->display_term);
wrbuf_puts(c->wrbuf, "</name>");
-
+ if (p[i]->id)
+ {
+ wrbuf_puts(c->wrbuf, "<value>");
+ wrbuf_xmlputs(c->wrbuf, p[i]->id);
+ wrbuf_puts(c->wrbuf, "</value>");
+ }
wrbuf_printf(c->wrbuf,
"<frequency>%d</frequency>",
p[i]->frequency);
}
void termlist_insert(struct termlist *tl, const char *display_term,
- const char *norm_term, int freq)
+ const char *norm_term, const char *id, size_t id_len,
+ int freq)
{
unsigned int bucket;
struct termlist_bucket **p;
new->term.norm_term = nmem_strdup(tl->nmem, buf);
new->term.display_term = *display_term ?
nmem_strdup(tl->nmem, display_term) : new->term.norm_term;
+ new->term.id = id ? nmem_strdupn(tl->nmem, id, id_len) : 0;
new->term.frequency = freq;
new->next = 0;
*p = new;
{
char *norm_term;
char *display_term;
+ char *id;
int frequency;
};
struct termlist *termlist_create(NMEM nmem);
void termlist_insert(struct termlist *tl, const char *display_term,
- const char *norm_term, int freq);
+ const char *norm_term,
+ const char *id, size_t id_len, int freq);
struct termlist_score **termlist_highscore(struct termlist *tl, int *len,
NMEM nmem);