projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use YAZ' new icu_iter_get_org_info for snippets
[pazpar2-moved-to-github.git]
/
src
/
session.c
diff --git
a/src/session.c
b/src/session.c
index
00af02f
..
e3e0a0d
100644
(file)
--- 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;
/* 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)
{
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;
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);
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;
}
return sessions;
}
@@
-119,17
+117,6
@@
int sessions_count(void)
return session_use(0);
}
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();
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);
}
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;
{
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.disp = p;
rec_md->data.text.sort = 0;
+ rec_md->data.text.snippet = 0;
}
else if (type == Metadata_type_year || type == Metadata_type_date)
{
}
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;
}
"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;
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);
}
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))
{
// construct facets ... unless the client already has reported them
if (ser_md->termlist && !client_has_facet(cl, (char *) type))
{