From 4d0ef95b01450f0462d1b2bffccbc3cefb5c2996 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Thu, 20 May 2010 00:37:46 +0100 Subject: [PATCH] isRelation() recognises word-form relations from context sets. parseTerm() accumulates multi-word query terms. --- src/main/java/org/z3950/zing/cql/CQLParser.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/z3950/zing/cql/CQLParser.java b/src/main/java/org/z3950/zing/cql/CQLParser.java index dab0e80..25b49d0 100644 --- a/src/main/java/org/z3950/zing/cql/CQLParser.java +++ b/src/main/java/org/z3950/zing/cql/CQLParser.java @@ -192,7 +192,12 @@ public class CQLParser { debug("non-parenthesised term"); word = matchSymbol("index or term"); - if (!isSymbolicRelation() && lexer.ttype != lexer.TT_WORD) + while (lexer.ttype == lexer.TT_WORD && !isRelation()) { + word = word + " " + lexer.sval; + match(lexer.TT_WORD); + } + + if (!isRelation()) break; index = word; @@ -235,10 +240,11 @@ public class CQLParser { debug("isRelation: checking ttype=" + lexer.ttype + " (" + lexer.render() + ")"); if (lexer.ttype == lexer.TT_WORD && - (lexer.sval == "exact" || - lexer.sval == "any" || - lexer.sval == "all" || - (lexer.sval == "scr" && compat == V1POINT2))) + (lexer.sval.indexOf('.') >= 0 || + lexer.sval.equals("exact") || + lexer.sval.equals("any") || + lexer.sval.equals("all") || + (lexer.sval.equals("scr") && compat == V1POINT2))) return true; return isSymbolicRelation(); -- 1.7.10.4