CQL/CCL to RPN. Checks for leading @
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 Sep 2011 09:13:52 +0000 (11:13 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 Sep 2011 09:13:52 +0000 (11:13 +0200)
Special case, since @ precedes PQF operators.

src/querytowrbuf.c
test/cql2pqf/5.5.err [new file with mode: 0644]
test/cql2pqf/5.5.out [new file with mode: 0644]
test/cql2pqfsample
test/test_ccl.c

index 8ca78a2..109fec6 100644 (file)
@@ -24,6 +24,8 @@ void yaz_encode_pqf_term(WRBUF b, const char *term, int len)
             break;
     if (len > 0 && i == len)
     {
+        if (term[0] == '@')
+            wrbuf_putc(b, '\\');
         for (i = 0; i<len; i++)
         {
             if (term[i] == '\\')
diff --git a/test/cql2pqf/5.5.err b/test/cql2pqf/5.5.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/cql2pqf/5.5.out b/test/cql2pqf/5.5.out
new file mode 100644 (file)
index 0000000..24f2383
--- /dev/null
@@ -0,0 +1,2 @@
+Parsing CQL @and
+@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "@and" 
index a11bbd4..04f928d 100644 (file)
@@ -37,3 +37,4 @@ a*\\3
 \\*a#
 \\*a*b#
 \\"
+@and
index bb54243..c4fdf79 100644 (file)
@@ -338,6 +338,13 @@ void tst1(int pass)
                             "@and @attr 5=1 @attr 4=2 @attr 1=1016 a "
                             "@attr 4=2 @attr 1=1016 b? "));
 
+    YAZ_CHECK(tst_ccl_query(bibset, "@and",
+                            "@attr 4=2 @attr 1=1016 \\@and "));
+                            
+    YAZ_CHECK(tst_ccl_query(bibset, "a@and",
+                            "@attr 4=2 @attr 1=1016 a@and "));
+                            
+
     ccl_qual_rm(&bibset);
 }