struct client_list *next;
};
-struct session_sorted_results {
- const char *field;
- int increasing;
- struct session_sorted_results *next;
-};
-
/* session counting (1) , disable client counting (0) */
static YAZ_MUTEX g_session_mutex = 0;
static int no_sessions = 0;
}
}
sdb->map = normalize_cache_get(se->normalize_cache,
- se->service->server->config, s);
+ se->service, s);
if (!sdb->map)
return -1;
}
return res == 0;
}
-static const char *get_strategy_plus_sort(struct client *l, const char *field)
-{
- struct session_database *sdb = client_get_database(l);
- struct setting *s;
-
- const char *strategy_plus_sort = 0;
-
- for (s = sdb->settings[PZ_SORTMAP]; s; s = s->next)
- {
- char *p = strchr(s->name + 3, ':');
- if (!p)
- {
- yaz_log(YLOG_WARN, "Malformed sortmap name: %s", s->name);
- continue;
- }
- p++;
- if (!strcmp(p, field))
- {
- strategy_plus_sort = s->value;
- break;
- }
- }
- return strategy_plus_sort;
-}
-
void session_sort(struct session *se, const char *field, int increasing)
{
struct session_sorted_results *sr;
for (l = se->clients; l; l = l->next)
{
struct client *cl = l->client;
- const char *strategy_plus_sort = get_strategy_plus_sort(cl, field);
- if (strategy_plus_sort)
- {
- struct timeval tval;
- if (client_prep_connection(cl, se->service->z3950_operation_timeout,
- se->service->z3950_session_timeout,
- se->service->server->iochan_man,
- &tval))
- client_start_search(cl, strategy_plus_sort, increasing);
- }
+ struct timeval tval;
+ if (client_prep_connection(cl, se->service->z3950_operation_timeout,
+ se->service->z3950_session_timeout,
+ se->service->server->iochan_man,
+ &tval))
+ client_start_search(cl);
}
session_leave(se);
}
for (l = se->clients; l; l = l->next)
{
struct client *cl = l->client;
- const char *strategy_plus_sort = get_strategy_plus_sort(cl, sort_field);
if (maxrecs)
client_set_maxrecs(cl, atoi(maxrecs));
se->service->z3950_session_timeout,
se->service->server->iochan_man,
&tval))
- client_start_search(cl, strategy_plus_sort, increasing);
+ client_start_search(cl);
}
}
facet_limits_destroy(facet_limits);
yaz_mutex_destroy(&se->session_mutex);
}
-/* Depreciated: use session_destroy */
-void destroy_session(struct session *se)
-{
- session_destroy(se);
-}
-
size_t session_get_memory_status(struct session *session) {
size_t session_nmem;
if (session == 0)
return session;
}
+const char * client_get_suggestions_xml(struct client *cl, WRBUF wrbuf);
+
static struct hitsbytarget *hitsbytarget_nb(struct session *se,
int *count, NMEM nmem)
{
res[*count].connected = client_get_connection(cl) ? 1 : 0;
session_settings_dump(se, client_get_database(cl), w);
res[*count].settings_xml = nmem_strdup(nmem, wrbuf_cstr(w));
+ wrbuf_rewind(w);
+ wrbuf_puts(w, "");
+ res[*count].suggestions_xml = nmem_strdup(nmem, client_get_suggestions_xml(cl, w));
wrbuf_destroy(w);
(*count)++;
}
for (j = 0; j < num_names; j++)
{
const char *tname;
+
+ wrbuf_puts(c->wrbuf, "<list name=\"");
+ wrbuf_xmlputs(c->wrbuf, names[j]);
+ wrbuf_puts(c->wrbuf, "\">\n");
+
for (i = 0; i < se->num_termlists; i++)
{
tname = se->termlists[i].name;
if (p)
{
int i;
- wrbuf_puts(c->wrbuf, "<list name=\"");
- wrbuf_xmlputs(c->wrbuf, tname);
- wrbuf_puts(c->wrbuf, "\">\n");
for (i = 0; i < len && i < num; i++)
{
// prevent sending empty term elements
p[i]->frequency);
wrbuf_puts(c->wrbuf, "</term>\n");
}
- wrbuf_puts(c->wrbuf, "</list>\n");
}
}
}
tname = "xtargets";
if (num_names > 0 && !strcmp(names[j], tname))
{
- wrbuf_puts(c->wrbuf, "<list name=\"");
- wrbuf_xmlputs(c->wrbuf, tname);
- wrbuf_puts(c->wrbuf, "\">\n");
targets_termlist_nb(c->wrbuf, se, num, c->nmem);
- wrbuf_puts(c->wrbuf, "</list>\n");
}
+ wrbuf_puts(c->wrbuf, "</list>\n");
}
session_leave(se);
nmem_destroy(nmem_tmp);