From 7c4d6e0fc700107e781c668ebd4ba0ac79f843b3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 26 Jun 2015 21:29:09 +0200 Subject: [PATCH] rpn2solr: structure, relation problem for serverChoice YAZ-849 --- src/rpn2cql.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/rpn2cql.c b/src/rpn2cql.c index 842d1a9..b0a6e43 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -120,34 +120,30 @@ static int rpn2cql_attr(cql_transform_t ct, wrbuf_rewind(w); return YAZ_BIB1_UNSUPP_USE_ATTRIBUTE; } - /* for serverChoice we omit index+relation+structure */ - if (strcmp(index, "cql.serverChoice")) + if (!relation) + relation = "="; + else if (!strcmp(relation, "exact")) + relation = "=="; + else if (!strcmp(relation, "eq")) + relation = "="; + else if (!strcmp(relation, "le")) + relation = "<="; + else if (!strcmp(relation, "ge")) + relation = ">="; + + if (strcmp(index, "cql.serverChoice") || strcmp(relation, "=") + || (structure && strcmp(structure, "*"))) { wrbuf_puts(w, index); - if (relation) - { - if (!strcmp(relation, "exact")) - relation = "=="; - else if (!strcmp(relation, "eq")) - relation = "="; - else if (!strcmp(relation, "le")) - relation = "<="; - else if (!strcmp(relation, "ge")) - relation = ">="; - /* Missing mapping of not equal, phonetic, stem and relevance */ - wrbuf_puts(w, relation); - } - else - wrbuf_puts(w, "="); + wrbuf_puts(w, " "); + wrbuf_puts(w, relation); + wrbuf_puts(w, " "); - if (structure) + if (structure && strcmp(structure, "*")) { - if (strcmp(structure, "*")) - { - wrbuf_puts(w, "/"); - wrbuf_puts(w, structure); - wrbuf_puts(w, " "); - } + wrbuf_puts(w, "/"); + wrbuf_puts(w, structure); + wrbuf_puts(w, " "); } } return 0; -- 1.7.10.4