-/* $Id: config.c,v 1.40 2007-07-30 23:16:33 quinn Exp $
- Copyright (c) 2006-2007, Index Data.
-
-This file is part of Pazpar2.
+/* This file is part of Pazpar2.
+ Copyright (C) 2006-2008 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
for more details.
You should have received a copy of the GNU General Public License
-along with Pazpar2; see the file LICENSE. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
- */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: config.c,v 1.40 2007-07-30 23:16:33 quinn Exp $ */
+*/
+
+/* $Id: config.c,v 1.42 2007-10-31 05:29:08 quinn Exp $ */
#include <string.h>
metadata->name = nmem_strdup(nmem, name);
- // enforcing that merge_range is always type_year
- if (merge == Metadata_merge_range)
- metadata->type = Metadata_type_year;
- else
- metadata->type = type;
+ metadata->type = type;
// enforcing that type_year is always range_merge
if (metadata->type == Metadata_type_year)
type = Metadata_type_generic;
else if (!strcmp((const char *) xml_type, "year"))
type = Metadata_type_year;
+ else if (!strcmp((const char *) xml_type, "date"))
+ type = Metadata_type_date;
else
{
yaz_log(YLOG_FATAL,
server->service = 0;
server->next = 0;
server->settings = 0;
-
-#ifdef HAVE_ICU
- server->icu_chn = 0;
-#endif // HAVE_ICU
-
+ server->relevance_pct = 0;
+ server->sort_pct = 0;
+ server->mergekey_pct = 0;
for (n = node->children; n; n = n->next)
{
if (!(server->settings = parse_settings(n)))
return 0;
}
- else if (!strcmp((const char *) n->name, "icu_chain"))
+ else if (!strcmp((const char *) n->name, "relevance"))
{
-#ifdef HAVE_ICU
- UErrorCode status = U_ZERO_ERROR;
- struct icu_chain *chain = icu_chain_xml_config(n, &status);
- if (!chain || U_FAILURE(status)){
- //xmlDocPtr icu_doc = 0;
- //xmlChar *xmlstr = 0;
- //int size = 0;
- //xmlDocDumpMemory(icu_doc, size);
-
- yaz_log(YLOG_FATAL, "Could not parse ICU chain config:\n"
- "<%s>\n ... \n</%s>",
- n->name, n->name);
- return 0;
- }
- server->icu_chn = chain;
-#else // HAVE_ICU
- yaz_log(YLOG_FATAL, "Error: ICU support requested with element:\n"
- "<%s>\n ... \n</%s>",
- n->name, n->name);
- yaz_log(YLOG_FATAL,
- "But no ICU support compiled into pazpar2 server.");
- yaz_log(YLOG_FATAL,
- "Please install libicu36-dev and icu-doc or similar, "
- "re-configure and re-compile");
- return 0;
-#endif // HAVE_ICU
+ server->relevance_pct = pp2_charset_create_xml(n->children);
+ }
+ else if (!strcmp((const char *) n->name, "sort"))
+ {
+ server->sort_pct = pp2_charset_create_xml(n->children);
+ }
+ else if (!strcmp((const char *) n->name, "mergekey"))
+ {
+ server->mergekey_pct = pp2_charset_create_xml(n->children);
}
else if (!strcmp((const char *) n->name, "service"))
{
return 0;
}
}
+ if (!server->relevance_pct)
+ server->relevance_pct = pp2_charset_create(0);
+ if (!server->sort_pct)
+ server->sort_pct = pp2_charset_create(0);
+ if (!server->mergekey_pct)
+ server->mergekey_pct = pp2_charset_create(0);
return server;
}