Added workaround for unknown overlap frame
diff --git a/CHANGES b/CHANGES
index 372eb15..410ffd8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
-0.49 2014-11-08
+0.49 2014-11-11
- [bugfix] Rewrite works in repeating expansions (margaretha)
- [feature] Clean timeout with parameter support (diewald)
+ - [workaround] Support unknown overlap frame, if frames are known (diewald)
0.48 2014-11-07
- [feature] Retrieval of token lists (diewald)
@@ -13,7 +14,7 @@
correctly rewritten (diewald)
- [bugfix] Ignore foundry for orth layer (diewald)
- [feature] Support fields in meta (diewald)
- - [sigh] Support more legacy APIs (diewald)
+ - [workaround] Support more legacy APIs (diewald)
- [bugfix] Check for the existence of @type in JSON-LD groups
to avoid NullPointer (diewald)
- [cleanup] Validated query and collection input - limited
diff --git a/src/main/java/de/ids_mannheim/korap/KorapQuery.java b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
index 9f3a94c..53fbe8d 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
@@ -205,6 +205,16 @@
case "frame:strictlyOverlaps":
flag = REAL_OVERLAP;
break;
+ case "":
+ // Temporary workaround for wrongly set overlaps
+ if (json.has("frames")) {
+ frame = json.get("frames").get(0).asText();
+ if (frame.equals("frames:overlapsLeft") ||
+ frame.equals("frames:overlapsRight")) {
+ flag = OVERLAP;
+ break;
+ };
+ };
default:
throw new QueryException(613, "Frame type unknown");
};
diff --git a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
index bdf81f8..a6379ec 100644
--- a/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
+++ b/src/main/java/de/ids_mannheim/korap/index/FieldDocument.java
@@ -332,7 +332,7 @@
@Override
public void setTextColumn (String textColumn) {
super.setTextColumn(textColumn);
- this.addStored("textColumn", textColumn);
+ this.addString("textColumn", textColumn);
};
@Override
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
index e8d8084..32109cd 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -324,6 +324,15 @@
assertEquals(sqwi.toQuery().toString(), "spanRepetition(spanExpansion(SpanMultiTermQueryWrapper(tokens:/cnx/p:A/), []{1, 1}, right){2,2})");
};
+ @Test
+ public void queryJSONoverlapsFrameWorkaround () throws QueryException {
+ // overlaps(<s>,[tt/p=CARD][tt/p="N.*"])
+ SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bugs/overlaps_frame_workaround.jsonld").getFile());
+
+ assertEquals(sqwi.toQuery().toString(), "spanOverlap(<tokens:s />, spanNext(tokens:tt/p:CARD, SpanMultiTermQueryWrapper(tokens:/tt/p:N.*/)))");
+ };
+
+
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
diff --git a/src/test/resources/queries/bugs/overlaps_frame_workaround.jsonld b/src/test/resources/queries/bugs/overlaps_frame_workaround.jsonld
new file mode 100644
index 0000000..4d72095
--- /dev/null
+++ b/src/test/resources/queries/bugs/overlaps_frame_workaround.jsonld
@@ -0,0 +1,45 @@
+{
+ "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+ "query" : {
+ "@type" : "korap:group",
+ "frame" : "",
+ "frames" : [
+ "frames:overlapsLeft",
+ "frames:overlapsRight"
+ ],
+ "operands" : [
+ {
+ "@type" : "korap:span",
+ "key" : "s"
+ },
+ {
+ "@type" : "korap:group",
+ "operands" : [
+ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "foundry" : "tt",
+ "key" : "CARD",
+ "layer" : "p",
+ "match" : "match:eq"
+ }
+ },
+ {
+ "@type" : "korap:token",
+ "wrap" : {
+ "@type" : "korap:term",
+ "foundry" : "tt",
+ "key" : "N.*",
+ "layer" : "p",
+ "match" : "match:eq",
+ "type" : "type:regex"
+ }
+ }
+ ],
+ "operation" : "operation:sequence"
+ }
+ ],
+ "operation" : "operation:position"
+ }
+}