X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frpn2cql.c;h=25ee13894976f56aea84e3ecf7425122e8d8d7ca;hp=9fedba654d0ac1788d5e6dda1ed3e77b07147a16;hb=266cfeafc17930bfa6fb7eed92f80b8c751f43b4;hpb=c508282c3e52e145f998d0bb85c0ea6b36fe956c diff --git a/src/rpn2cql.c b/src/rpn2cql.c index 9fedba6..25ee138 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ /** @@ -69,27 +69,27 @@ static const char *lookup_relation_index_from_attr(Z_AttributeList *attributes) switch (*relation) { /* Unsure on whether this is the relation attribute constants? */ - case Z_ProximityOperator_Prox_lessThan: + case Z_ProximityOperator_Prox_lessThan: return "<"; - case Z_ProximityOperator_Prox_lessThanOrEqual: - return "<="; - case Z_ProximityOperator_Prox_equal: - return "="; - case Z_ProximityOperator_Prox_greaterThanOrEqual: - return ">="; - case Z_ProximityOperator_Prox_greaterThan: - return ">"; - case Z_ProximityOperator_Prox_notEqual: - return "<>"; - case 100: + case Z_ProximityOperator_Prox_lessThanOrEqual: + return "<="; + case Z_ProximityOperator_Prox_equal: + return "="; + case Z_ProximityOperator_Prox_greaterThanOrEqual: + return ">="; + case Z_ProximityOperator_Prox_greaterThan: + return ">"; + case Z_ProximityOperator_Prox_notEqual: + return "<>"; + case 100: /* phonetic is not supported in CQL */ - return 0; - case 101: + return 0; + case 101: /* stem is not supported in CQL */ - return 0; - case 102: + return 0; + case 102: /* relevance is supported in CQL, but not implemented yet */ - return 0; + return 0; default: /* Invalid relation */ return 0; @@ -117,7 +117,7 @@ static int rpn2cql_attr(cql_transform_t ct, index = lookup_index_from_string_attr(attributes); /* Attempt to fix bug #2978: Look for a relation attribute */ - if (!relation) + if (!relation) relation = lookup_relation_index_from_attr(attributes); if (!index) @@ -194,7 +194,6 @@ static int rpn2cql_simple(cql_transform_t ct, size_t lterm = 0; Odr_int trunc = lookup_truncation(apt->attributes); size_t i; - int must_quote = 0; wrbuf_rewind(w); ret = rpn2cql_attr(ct, apt->attributes, w); @@ -219,12 +218,16 @@ static int rpn2cql_simple(cql_transform_t ct, if (trunc <= 3 || trunc == 100 || trunc == 102 || trunc == 104) { + int quote_it = 0; for (i = 0 ; i < lterm; i++) if (strchr(" ()=>