CQL: fix extra terms in wrong order
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 7 Mar 2012 11:46:37 +0000 (12:46 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 7 Mar 2012 11:46:37 +0000 (12:46 +0100)
src/cql.y
test/cql/11.2.out
test/cql/11.4.out
test/cql/11.7.out
test/test_cql2ccl.c

index 128dc87..cf6995e 100644 (file)
--- a/src/cql.y
+++ b/src/cql.y
@@ -162,10 +162,10 @@ searchTerm extraTerms {
 ;
 
 extraTerms:
 ;
 
 extraTerms:
-extraTerms SIMPLE_STRING {
+SIMPLE_STRING extraTerms {
     struct cql_node *st = cql_node_mk_sc(((CQL_parser) parm)->nmem, 
     struct cql_node *st = cql_node_mk_sc(((CQL_parser) parm)->nmem, 
-                                        /* index */ 0, /* rel */ 0, $2.buf);
-    st->u.st.extra_terms = $1.cql;
+                                        /* index */ 0, /* rel */ 0, $1.buf);
+    st->u.st.extra_terms = $2.cql;
     $$.cql = st;
 }
 | 
     $$.cql = st;
 }
 | 
index 58fd9bd..aaa51fb 100644 (file)
@@ -4,6 +4,6 @@
     <value>=</value>
   </relation>
   <term>a</term>
     <value>=</value>
   </relation>
   <term>a</term>
-  <term>c</term>
   <term>b</term>
   <term>b</term>
+  <term>c</term>
 </searchClause>
 </searchClause>
index 37dbf3f..ef54784 100644 (file)
@@ -4,6 +4,6 @@
     <value>=</value>
   </relation>
   <term>and</term>
     <value>=</value>
   </relation>
   <term>and</term>
-  <term>c</term>
   <term>b</term>
   <term>b</term>
+  <term>c</term>
 </searchClause>
 </searchClause>
index 6073292..0d59eb1 100644 (file)
@@ -9,9 +9,9 @@
         <value>=</value>
       </relation>
       <term>dc.title</term>
         <value>=</value>
       </relation>
       <term>dc.title</term>
-      <term>c</term>
-      <term>b</term>
       <term>a</term>
       <term>a</term>
+      <term>b</term>
+      <term>c</term>
     </searchClause>
   </leftOperand>
   <rightOperand>
     </searchClause>
   </leftOperand>
   <rightOperand>
index 95c1ad7..c050f7e 100644 (file)
@@ -141,6 +141,8 @@ static void tst(void)
     YAZ_CHECK(tst_query("title = \"x y\"", "title=\"x y\""));
     YAZ_CHECK(tst_query("title = x y", "title=\"x\" \"y\""));
 
     YAZ_CHECK(tst_query("title = \"x y\"", "title=\"x y\""));
     YAZ_CHECK(tst_query("title = x y", "title=\"x\" \"y\""));
 
+    YAZ_CHECK(tst_query("title = x y z",  "title=\"x\" \"y\" \"z\""));
+
     YAZ_CHECK(tst_query("dc.title=encyclopedia prox dinosaurs",
                         "(dc.title=\"encyclopedia\") % (\"dinosaurs\")"));
     YAZ_CHECK(tst_query("dc.title=encyclopedia prox/distance<=3 dinosaurs",
     YAZ_CHECK(tst_query("dc.title=encyclopedia prox dinosaurs",
                         "(dc.title=\"encyclopedia\") % (\"dinosaurs\")"));
     YAZ_CHECK(tst_query("dc.title=encyclopedia prox/distance<=3 dinosaurs",