#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include "ppmutex.h"
#include "incref.h"
#include "pazpar2_config.h"
#include "settings.h"
service->relevance_pct = 0;
service->sort_pct = 0;
service->mergekey_pct = 0;
+ service->facet_pct = 0;
service->id = service_id ? nmem_strdup(nmem, service_id) : 0;
service->num_metadata = num_metadata;
pp2_charset_destroy(service->relevance_pct);
pp2_charset_destroy(service->sort_pct);
pp2_charset_destroy(service->mergekey_pct);
+ pp2_charset_destroy(service->facet_pct);
yaz_mutex_destroy(&service->mutex);
nmem_destroy(service->nmem);
}
return 0;
}
}
+ else if (!strcmp((const char *) n->name, "facet"))
+ {
+ if (service->mergekey_pct)
+ {
+ yaz_log(YLOG_LOG, "facety may not repeat in service");
+ return 0;
+ }
+ else
+ {
+ service->facet_pct = pp2_charset_create_xml(n);
+ if (!service->mergekey_pct)
+ return 0;
+ }
+ }
else if (!strcmp((const char *) n->name, (const char *) "metadata"))
{
if (parse_metadata(service, n, &md_node, &sk_node))
}
}
- /* use relevance/sort/mergekey from server if not defined
+ /* use relevance/sort/mergekey/facet from server if not defined
for this service.. */
if (!s->relevance_pct)
{
pp2_charset_incref(s->relevance_pct);
}
else
- s->relevance_pct = pp2_charset_create(0);
+ s->relevance_pct = pp2_charset_create_a_to_z();
}
if (!s->sort_pct)
pp2_charset_incref(s->sort_pct);
}
else
- s->sort_pct = pp2_charset_create(0);
+ s->sort_pct = pp2_charset_create_a_to_z();
}
if (!s->mergekey_pct)
pp2_charset_incref(s->mergekey_pct);
}
else
- s->mergekey_pct = pp2_charset_create(0);
+ s->mergekey_pct = pp2_charset_create_a_to_z();
+ }
+
+ if (!s->facet_pct)
+ {
+ if (server->facet_pct)
+ {
+ s->facet_pct = server->facet_pct;
+ pp2_charset_incref(s->facet_pct);
+ }
+ else
+ s->facet_pct = pp2_charset_create(0);
}
}
inherit_server_settings(service);
resolve_databases(service);
assert(service->mutex == 0);
- yaz_mutex_create(&service->mutex);
+ pazpar2_mutex_create(&service->mutex, "conf");
}
return service;
}
server->relevance_pct = 0;
server->sort_pct = 0;
server->mergekey_pct = 0;
+ server->facet_pct = 0;
server->server_settings = 0;
server->http_server = 0;
server->iochan_man = 0;
if (!server->mergekey_pct)
return 0;
}
+ else if (!strcmp((const char *) n->name, "facet"))
+ {
+ server->facet_pct = pp2_charset_create_xml(n);
+ if (!server->facet_pct)
+ return 0;
+ }
else if (!strcmp((const char *) n->name, "service"))
{
char *service_id = (char *)
return server;
}
-WRBUF conf_get_fname(struct conf_service *service, const char *fname)
+WRBUF conf_get_fname(struct conf_config *config, const char *fname)
{
- struct conf_config *config = service->server->config;
WRBUF w = wrbuf_alloc();
conf_dir_path(config, w, fname);
pp2_charset_destroy(server->relevance_pct);
pp2_charset_destroy(server->sort_pct);
pp2_charset_destroy(server->mergekey_pct);
+ pp2_charset_destroy(server->facet_pct);
yaz_log(YLOG_LOG, "server_destroy server=%p", server);
http_server_destroy(server->http_server);
}
{
resolve_databases(s);
assert(s->mutex == 0);
- yaz_mutex_create(&s->mutex);
+ pazpar2_mutex_create(&s->mutex, "service");
}
http_mutex_init(ser);
}