X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fsession.c;h=9b69b3860124c7ed292c48188c48c52c55ec7e01;hb=98dbaf0f7a4ea46aa3330d79c90f802fc0671f41;hp=373dd49e590e5f26260bb9304b354f37a1adcf73;hpb=9ac9ee0172c5440d7dab879756893d943e313143;p=pazpar2-moved-to-github.git diff --git a/src/session.c b/src/session.c index 373dd49..9b69b38 100644 --- a/src/session.c +++ b/src/session.c @@ -191,20 +191,39 @@ void add_facet(struct session *s, const char *type, const char *value, int count pp2_relevance_token_t prt; const char *facet_component; WRBUF facet_wrbuf = wrbuf_alloc(); + WRBUF display_wrbuf = wrbuf_alloc(); + int i; + const char *icu_chain_id = 0; + + for (i = 0; i < service->num_metadata; i++) + if (!strcmp((service->metadata + i)->name, type)) + icu_chain_id = (service->metadata + i)->icu_chain; + yaz_log(YLOG_LOG, "icu_chain id=%s", icu_chain_id ? icu_chain_id : "null"); + prt = pp2_relevance_tokenize(service->facet_pct); pp2_relevance_first(prt, value, 0); while ((facet_component = pp2_relevance_token_next(prt))) { + const char *display_component; if (*facet_component) { if (wrbuf_len(facet_wrbuf)) wrbuf_puts(facet_wrbuf, " "); wrbuf_puts(facet_wrbuf, facet_component); } + display_component = pp2_get_display(prt); + if (display_component) + { + if (wrbuf_len(display_wrbuf)) + wrbuf_puts(display_wrbuf, " "); + wrbuf_puts(display_wrbuf, display_component); + } } pp2_relevance_token_destroy(prt); - + + yaz_log(YLOG_LOG, "facet norm=%s", wrbuf_cstr(facet_wrbuf)); + yaz_log(YLOG_LOG, "facet display=%s", wrbuf_cstr(display_wrbuf)); if (wrbuf_len(facet_wrbuf)) { int i; @@ -229,10 +248,11 @@ void add_facet(struct session *s, const char *type, const char *value, int count #if 0 session_log(s, YLOG_DEBUG, "Facets for %s: %s norm:%s (%d)", type, value, wrbuf_cstr(facet_wrbuf), count); #endif - termlist_insert(s->termlists[i].termlist, wrbuf_cstr(facet_wrbuf), - count); + termlist_insert(s->termlists[i].termlist, wrbuf_cstr(display_wrbuf), + wrbuf_cstr(facet_wrbuf), count); } wrbuf_destroy(facet_wrbuf); + wrbuf_destroy(display_wrbuf); } static xmlDoc *record_to_xml(struct session *se, @@ -782,7 +802,6 @@ void session_destroy(struct session *se) { nmem_destroy(se->nmem); service_destroy(se->service); yaz_mutex_destroy(&se->session_mutex); - wrbuf_destroy(se->wrbuf); } /* Depreciated: use session_destroy */ @@ -825,7 +844,6 @@ struct session *new_session(NMEM nmem, struct conf_service *service, session->clients = 0; session->session_nmem = nmem; session->nmem = nmem_create(); - session->wrbuf = wrbuf_alloc(); session->databases = 0; for (i = 0; i <= SESSION_WATCH_MAX; i++) {