From: Adam Dickmeiss Date: Wed, 20 Feb 2013 13:47:18 +0000 (+0100) Subject: Honor CQL unmasked modifier + tests X-Git-Tag: v4.2.52~16 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=18c13c600539404ef7b6912ded8d3294c178380c;ds=sidebyside Honor CQL unmasked modifier + tests Add regexp/masked/unmasked to pqf.properties. --- diff --git a/etc/pqf.properties b/etc/pqf.properties index 380f7ed..438ecb7 100644 --- a/etc/pqf.properties +++ b/etc/pqf.properties @@ -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 diff --git a/src/cqltransform.c b/src/cqltransform.c index efb15e8..8253e50 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -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 index 0000000..e69de29 diff --git a/test/cql2pqf/6.1.out b/test/cql2pqf/6.1.out new file mode 100644 index 0000000..8d958b7 --- /dev/null +++ b/test/cql2pqf/6.1.out @@ -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 index 0000000..e69de29 diff --git a/test/cql2pqf/6.2.out b/test/cql2pqf/6.2.out new file mode 100644 index 0000000..ba2736e --- /dev/null +++ b/test/cql2pqf/6.2.out @@ -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 index 0000000..e69de29 diff --git a/test/cql2pqf/6.3.out b/test/cql2pqf/6.3.out new file mode 100644 index 0000000..f18c38a --- /dev/null +++ b/test/cql2pqf/6.3.out @@ -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" diff --git a/test/cql2pqfsample b/test/cql2pqfsample index e13cb7a..0740b48 100644 --- a/test/cql2pqfsample +++ b/test/cql2pqfsample @@ -43,3 +43,7 @@ a^ ^a^ \\^ ^a\\^ +# masking modifiers +dc.title=/unmasked a*b +dc.title=/masked a*b +dc.title=/regexp a.*b