error when using inequation with non-date
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
index 15a1f11..dc3405a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
@@ -100,7 +100,10 @@
term.putAll(parseValue(valueNodes.get(0)));
String match = operatorNodes.get(0).getText();
term.put("match", "match:" + interpretMatch(match));
- checkOperatorValueConformance(term);
+ if (checkOperatorValueConformance(term) == 1) {
+ requestMap.put("query", new LinkedHashMap<String,Object>());
+ return;
+ }
putIntoSuperObject(term);
} else { // (valueNodes.size()==2)
LinkedHashMap<String, Object> termGroup = makeDocGroup("and");
@@ -112,7 +115,10 @@
String match1 = operatorNodes.get(0).getText();
term1.put("match", "match:" + invertInequation(interpretMatch(match1)));
termGroupOperands.add(term1);
- checkOperatorValueConformance(term1);
+ if (checkOperatorValueConformance(term1) == 1) {
+ requestMap.put("query", new LinkedHashMap<String,Object>());
+ return;
+ }
LinkedHashMap<String, Object> term2 = makeDoc();
term2.put("key", field);
@@ -120,7 +126,10 @@
String match2 = operatorNodes.get(1).getText();
term2.put("match", "match:" + interpretMatch(match2));
termGroupOperands.add(term2);
- checkOperatorValueConformance(term2);
+ if (checkOperatorValueConformance(term2) == 1) {
+ requestMap.put("query", new LinkedHashMap<String,Object>());
+ return;
+ }
putIntoSuperObject(termGroup);
}
@@ -203,15 +212,17 @@
}
- private void checkOperatorValueConformance(LinkedHashMap<String, Object> term) {
+ private int checkOperatorValueConformance(LinkedHashMap<String, Object> term) {
String match = (String) term.get("match");
String type = (String) term.get("type");
if (type == null || type.equals("type:regex")) {
if (!(match.equals("match:eq") || match.equals("match:ne"))) {
errorMsgs.add("You used an inequation operator with a string value.");
System.err.println("You used an inequation operator with a string value.");
+ return 1;
}
}
+ return 0;
}
private LinkedHashMap<String, Object> parseValue(ParseTree valueNode) {