Inform about incompatibilities and optimize text queries
Change-Id: I97a4f1782d3ea405d96a3b413448ea07a797b1b4
diff --git a/Changes b/Changes
index 0970e7d..50d7f41 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
-0.57 2018-04-04
- - [feature] Support text queries in metadata (diewald)
+0.57 2018-04-05
+ - [feature] Support text queries in metadata
+ (requires reindexing to work properly; diewald)
+ - [cleanup] Remove unnecessary case folding in meta field
+ text queries (diewald)
0.56.2 2018-03-23
- [feature] Introduce meta field retrieval method (diewald)
diff --git a/src/main/java/de/ids_mannheim/korap/KrillCollection.java b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
index 2afe0aa..afd544e 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
@@ -227,18 +227,21 @@
return this.cb.term(key, json.get("value").asText())
.not();
+ // Contains and containsnot (or excludes) is only
+ // effective on text fields and ineffective on
+ // string fields
case "match:contains":
return this.cb.text(key,
- json.get("value").asText().toLowerCase());
+ json.get("value").asText());
case "match:containsnot":
return this.cb.text(key,
- json.get("value").asText().toLowerCase()).not();
+ json.get("value").asText()).not();
// <LEGACY>
case "match:excludes":
return this.cb.text(key,
- json.get("value").asText().toLowerCase()).not();
+ json.get("value").asText()).not();
// </LEGACY>
};
@@ -258,12 +261,22 @@
else if (match.equals("match:ne")) {
return this.cb.re(key, json.get("value").asText()).not();
}
+
+ // Contains and containsnot (or excludes) is
+ // identical to eq and ne in case of regexes for the moment,
+ // though it may be beneficial to circumfix these
+ // with .*
else if (match.equals("match:contains")) {
return this.cb.re(key, json.get("value").asText());
}
+ else if (match.equals("match:containsnot")) {
+ return this.cb.re(key, json.get("value").asText());
+ }
+ // <LEGACY>
else if (match.equals("match:excludes")) {
return this.cb.re(key, json.get("value").asText()).not();
};
+ // </LEGACY>
throw new QueryException(841,
"Match relation unknown for type");