CQL: Don't treat \^ as anchor
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 13 Dec 2012 10:33:51 +0000 (11:33 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 13 Dec 2012 10:33:51 +0000 (11:33 +0100)
src/cqltransform.c

index ef93ca8..2b7c780 100644 (file)
@@ -629,7 +629,8 @@ static void emit_term(cql_transform_t ct,
 
     if (process_term && length > 0)
     {
 
     if (process_term && length > 0)
     {
-        if (length > 1 && term[0] == '^' && term[length-1] == '^')
+        if (length > 1 && term[0] == '^' && term[length-1] == '^' &&
+            term[length-2] != '\\')
         {
             cql_pr_attr(ct, "position", "firstAndLast", 0,
                         pr, client_data, YAZ_SRW_ANCHORING_CHAR_IN_UNSUPP_POSITION);
         {
             cql_pr_attr(ct, "position", "firstAndLast", 0,
                         pr, client_data, YAZ_SRW_ANCHORING_CHAR_IN_UNSUPP_POSITION);
@@ -643,7 +644,8 @@ static void emit_term(cql_transform_t ct,
             term++;
             length--;
         }
             term++;
             length--;
         }
-        else if (term[length-1] == '^')
+        else if (term[length-1] == '^' &&
+                 (length < 2 || term[length-2] != '\\'))
         {
             cql_pr_attr(ct, "position", "last", 0,
                         pr, client_data, YAZ_SRW_ANCHORING_CHAR_IN_UNSUPP_POSITION);
         {
             cql_pr_attr(ct, "position", "last", 0,
                         pr, client_data, YAZ_SRW_ANCHORING_CHAR_IN_UNSUPP_POSITION);