From: Adam Dickmeiss Date: Fri, 7 Mar 2014 12:23:48 +0000 (+0100) Subject: Allow deprecated ICU definitions again X-Git-Tag: v1.6.40~5 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=9fbd27ef57762d0f1aefcab59fb69b95e9155205;p=pazpar2-moved-to-github.git Allow deprecated ICU definitions again Partially reverts 77682ed3596450ab7b3caff707999d2f7977d614. --- diff --git a/src/charsets.c b/src/charsets.c index 32d5f4d..61b6f19 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -173,6 +173,20 @@ int pp2_charset_fact_define(pp2_charset_fact_t pft, xmlChar *id = 0; assert(xml_node); + + if (strcmp((const char *) xml_node->name, "icu_chain")) + { + yaz_log(YLOG_WARN, "Wrapper element <%s> deprecated", xml_node->name); + yaz_log(YLOG_LOG, "Use .. only", xml_node->name); + xml_node = xml_node->children; + while (xml_node && xml_node->type != XML_ELEMENT_NODE) + xml_node = xml_node->next; + } + if (!xml_node) + { + yaz_log(YLOG_FATAL, "Missing icu_chain element"); + return -1; + } pct = pp2_charset_create_xml(xml_node); if (!pct) return -1; diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index 4332397..0688b8e 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -639,9 +639,14 @@ static struct conf_service *service_create_static(struct conf_server *server, || !strcmp((const char *) n->name, "facet")) { - yaz_log(YLOG_FATAL, "No longer supported: <%s>", n->name); - yaz_log(YLOG_LOG, "Use .. instead", n->name); - return 0; + if (!service->charsets) + service->charsets = pp2_charset_fact_create(); + if (pp2_charset_fact_define(service->charsets, n, + (const char *) n->name)) + { + yaz_log(YLOG_FATAL, "ICU chain definition error"); + return 0; + } } else if (!strcmp((const char *) n->name, (const char *) "metadata")) { @@ -937,9 +942,14 @@ static struct conf_server *server_create(struct conf_config *config, || !strcmp((const char *) n->name, "mergekey") || !strcmp((const char *) n->name, "facet")) { - yaz_log(YLOG_FATAL, "No longer supported: <%s>", n->name); - yaz_log(YLOG_LOG, "Use .. instead", n->name); - return 0; + if (!server->charsets) + server->charsets = pp2_charset_fact_create(); + if (pp2_charset_fact_define(server->charsets, n, + (const char *) n->name)) + { + yaz_log(YLOG_FATAL, "ICU chain definition error"); + return 0; + } } else if (!strcmp((const char *) n->name, "service")) { diff --git a/test/test_icu.cfg b/test/test_icu.cfg index b51dafa..e3c1e89 100644 --- a/test/test_icu.cfg +++ b/test/test_icu.cfg @@ -18,12 +18,14 @@ - - - - - - + + + + + + + + [[:WhiteSpace:][,.!;]]* } [$] > ;