service->z3950_session_timeout = 180;
service->z3950_operation_timeout = 30;
service->rank_cluster = 1;
+ service->rank_debug = 0;
service->charsets = 0;
service->id = service_id ? nmem_strdup(nmem, service_id) : 0;
+
// Setup a dictionary from server.
service->dictionary = 0;
= nmem_malloc(nmem,
sizeof(struct conf_metadata) * service->num_metadata);
service->num_sortkeys = num_sortkeys;
+
+ service->default_sort = nmem_strdup(nmem, "relevance");
service->sortkeys = 0;
if (service->num_sortkeys)
service->sortkeys
else if (!strcmp((const char *) n->name, "rank"))
{
char *rank_cluster = (char *) xmlGetProp(n, (xmlChar *) "cluster");
+ char *rank_debug = (char *) xmlGetProp(n, (xmlChar *) "debug");
+ if (rank_cluster)
+ {
+ if (!strcmp(rank_cluster, "yes"))
+ service->rank_cluster = 1;
+ else if (!strcmp(rank_cluster, "no"))
+ service->rank_cluster = 0;
+ else
+ {
+ yaz_log(YLOG_FATAL, "service: rank@cluster boolean");
+ return 0;
+ }
+ }
+ if (rank_debug)
+ {
+ if (!strcmp(rank_debug, "yes"))
+ service->rank_debug = 1;
+ else if (!strcmp(rank_debug, "no"))
+ service->rank_debug = 0;
+ else
+ {
+ yaz_log(YLOG_FATAL, "service: rank@debug boolean");
+ return 0;
+ }
+ }
+ xmlFree(rank_cluster);
+ xmlFree(rank_debug);
+ }
+ else if (!strcmp((const char *) n->name, "sort-default"))
+ {
+ char *default_sort = (char *) xmlGetProp(n, (xmlChar *) "field");
- if (rank_cluster && !strcmp(rank_cluster, "yes"))
- service->rank_cluster = 1;
- else if (rank_cluster && !strcmp(rank_cluster, "no"))
- service->rank_cluster = 0;
+ if (default_sort && strcmp(default_sort, "")) {
+ service->default_sort = nmem_strdup(service->nmem, default_sort);
+ yaz_log(YLOG_LOG, "service %s: default sort order configured to: %s",
+ service_id, default_sort);
+ }
else
{
- yaz_log(YLOG_FATAL, "service: rank@cluster boolean");
+ yaz_log(YLOG_FATAL, "default sort order is invalid: %s", default_sort);
return 0;
}
- xmlFree(rank_cluster);
+ xmlFree(default_sort);
}
else
{