Honor CQL unmasked modifier + tests
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 20 Feb 2013 13:47:18 +0000 (14:47 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 20 Feb 2013 13:47:18 +0000 (14:47 +0100)
Add regexp/masked/unmasked to pqf.properties.

etc/pqf.properties
src/cqltransform.c
test/cql2pqf/6.1.err [new file with mode: 0644]
test/cql2pqf/6.1.out [new file with mode: 0644]
test/cql2pqf/6.2.err [new file with mode: 0644]
test/cql2pqf/6.2.out [new file with mode: 0644]
test/cql2pqf/6.3.err [new file with mode: 0644]
test/cql2pqf/6.3.out [new file with mode: 0644]
test/cql2pqfsample

index 380f7ed..438ecb7 100644 (file)
@@ -79,6 +79,9 @@ relationModifier.fuzzy                        = 5=103
        ### truncation=regExpr-2 (5=103) in Zebra is "fuzzy matching"
 relationModifier.stem                  = 2=101
 relationModifier.phonetic              = 2=100
+relationModifier.regexp                        = 5=102
+relationModifier.unmasked              = 5=100
+relationModifier.masked                        =
 
 # Non-standard extensions to provoke Zebra's inline sorting
 relationModifier.sort                  = 7=1
index efb15e8..8253e50 100644 (file)
@@ -586,7 +586,6 @@ static int has_modifier(struct cql_node *cn, const char *name) {
     return 0;
 }
 
-
 static void emit_term(cql_transform_t ct,
                       struct cql_node *cn,
                       const char *term, int length,
@@ -600,6 +599,8 @@ static void emit_term(cql_transform_t ct,
 
     if (has_modifier(cn, "regexp"))
         process_term = 0;
+    else if (has_modifier(cn, "unmasked"))
+        process_term = 0;
     else if (cql_lookup_property(ct, "truncation", 0, "cql"))
     {
         process_term = 0;
@@ -609,7 +610,7 @@ static void emit_term(cql_transform_t ct,
     assert(cn->which == CQL_NODE_ST);
 
     if (process_term)
-    {
+    {   /* convert term via truncation.things */
         unsigned anchor = 0;
         unsigned trunc = 0;
         for (i = 0; i < length; i++)
diff --git a/test/cql2pqf/6.1.err b/test/cql2pqf/6.1.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/cql2pqf/6.1.out b/test/cql2pqf/6.1.out
new file mode 100644 (file)
index 0000000..8d958b7
--- /dev/null
@@ -0,0 +1,2 @@
+Parsing CQL dc.title=/unmasked a*b
+@attr 6=1 @attr 2=3 @attr 4=1 @attr 1=4 @attr 5=100 "a*b" 
diff --git a/test/cql2pqf/6.2.err b/test/cql2pqf/6.2.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/cql2pqf/6.2.out b/test/cql2pqf/6.2.out
new file mode 100644 (file)
index 0000000..ba2736e
--- /dev/null
@@ -0,0 +1,2 @@
+Parsing CQL dc.title=/masked a*b
+@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=104 @attr 1=4 "a?b" 
diff --git a/test/cql2pqf/6.3.err b/test/cql2pqf/6.3.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/cql2pqf/6.3.out b/test/cql2pqf/6.3.out
new file mode 100644 (file)
index 0000000..f18c38a
--- /dev/null
@@ -0,0 +1,2 @@
+Parsing CQL dc.title=/regexp a.*b
+@attr 6=1 @attr 2=3 @attr 4=1 @attr 1=4 @attr 5=102 "a.*b" 
index e13cb7a..0740b48 100644 (file)
@@ -43,3 +43,7 @@ a^
 ^a^
 \\^
 ^a\\^
+# masking modifiers
+dc.title=/unmasked a*b
+dc.title=/masked a*b
+dc.title=/regexp a.*b