X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fsession.c;h=e3e0a0d87c52397ce19879e13ddb13ecabb7cb8a;hb=b22c4ae2c14eb5d2b991e6233cdea2a9fd7dcf6c;hp=00af02f9e1b9194c390caca8d339db5b6816078b;hpb=8b8116a8d0e10201f0bd56adba461d2bb9becc79;p=pazpar2-moved-to-github.git diff --git a/src/session.c b/src/session.c index 00af02f..e3e0a0d 100644 --- a/src/session.c +++ b/src/session.c @@ -97,7 +97,6 @@ struct client_list { /* session counting (1) , disable client counting (0) */ static YAZ_MUTEX g_session_mutex = 0; static int no_sessions = 0; -static int no_session_total = 0; static int session_use(int delta) { @@ -106,11 +105,10 @@ static int session_use(int delta) yaz_mutex_create(&g_session_mutex); yaz_mutex_enter(g_session_mutex); no_sessions += delta; - if (delta > 0) - no_session_total += delta; sessions = no_sessions; yaz_mutex_leave(g_session_mutex); - yaz_log(YLOG_DEBUG, "%s sessions=%d", delta == 0 ? "" : (delta > 0 ? "INC" : "DEC"), no_sessions); + yaz_log(YLOG_DEBUG, "%s sessions=%d", delta == 0 ? "" : + (delta > 0 ? "INC" : "DEC"), no_sessions); return sessions; } @@ -119,17 +117,6 @@ int sessions_count(void) return session_use(0); } -int session_count_total(void) -{ - int total = 0; - if (!g_session_mutex) - return 0; - yaz_mutex_enter(g_session_mutex); - total = no_session_total; - yaz_mutex_leave(g_session_mutex); - return total; -} - static void log_xml_doc(xmlDoc *doc) { FILE *lf = yaz_log_file(); @@ -162,10 +149,9 @@ static void session_leave(struct session *s, const char *caller) session_log(s, YLOG_DEBUG, "Session unlock by %s", caller); } -static void session_normalize_facet(struct session *s, const char *type, - const char *value, - WRBUF display_wrbuf, - WRBUF facet_wrbuf) +static void session_normalize_facet(struct session *s, + const char *type, const char *value, + WRBUF display_wrbuf, WRBUF facet_wrbuf) { struct conf_service *service = s->service; pp2_charset_token_t prt; @@ -1481,6 +1467,7 @@ static struct record_metadata *record_metadata_init( rec_md->data.text.disp = p; rec_md->data.text.sort = 0; + rec_md->data.text.snippet = 0; } else if (type == Metadata_type_year || type == Metadata_type_date) { @@ -1970,6 +1957,18 @@ static int ingest_to_cluster(struct client *cl, "for element '%s'", value, type); continue; } + + if (ser_md->type == Metadata_type_generic) + { + WRBUF w = wrbuf_alloc(); + if (relevance_snippet(se->relevance, + (char*) value, ser_md->name, w)) + rec_md->data.text.snippet = nmem_strdup(se->nmem, + wrbuf_cstr(w)); + wrbuf_destroy(w); + } + + wheretoput = &record->metadata[md_field_id]; while (*wheretoput) wheretoput = &(*wheretoput)->next; @@ -2197,7 +2196,6 @@ static int ingest_to_cluster(struct client *cl, relevance_countwords(se->relevance, cluster, (char *) value, rank, ser_md->name); } - // construct facets ... unless the client already has reported them if (ser_md->termlist && !client_has_facet(cl, (char *) type)) {