Readded test for multiple distances in a disjunction query
Change-Id: Ic90a9737d2a6505b2982f566eaeccf40315ac053
diff --git a/Changes b/Changes
index 893fda2..595bfcc 100644
--- a/Changes
+++ b/Changes
@@ -1,9 +1,11 @@
-0.54 2015-10-26
+0.54 2015-11-13
- [performance] Updated Lucene dependency from 4.10.3
to 5.0.0 (diewald)
- [bugfix] Minor fixes regarding invalid tokens in the
test suite (diewald)
- Fixed krill.properties test (diewald)
+ - Fixed multiple distances in disjunction query
+ (GitHub issue #2; margaretha)
0.53 2015-09-25
- [feature] Implemented new KrillCollection (diewald)
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index 1b6fd26..b676dec 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -562,7 +562,7 @@
// Fail to add json object
catch (IOException e) {
- log.error("File json not found");
+ log.error("File {} not found", json);
};
return (FieldDocument) null;
};
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index bde5902..c2028c7 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -848,6 +848,29 @@
@Test
+ public void searchJSONtokenDistanceSpanBug () throws IOException {
+ // Construct index
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(1, getClass().getResourceAsStream("/goe/AGX-00002.json"),
+ false);
+ ki.addDoc(2, getClass().getResourceAsStream("/bzk/D59-00089.json.gz"),
+ true);
+ ki.commit();
+
+ // ({1:Sonne []* Erde} | {2: Erde []* Sonne})
+ String json = getString(getClass().getResource(
+ "/queries/bugs/tokendistancespan_bug.jsonld").getFile()
+ );
+
+ Krill ks = new Krill(json);
+ Result kr = ks.apply(ki);
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode res = mapper.readTree(kr.toJsonString());
+ assertTrue(res.at("/errors").isMissingNode());
+ };
+
+
+ @Test
public void searchJSONCollection () throws IOException {
// Construct index
KrillIndex ki = new KrillIndex();
diff --git a/src/test/resources/queries/bugs/tokendistancespan_bug.jsonld b/src/test/resources/queries/bugs/tokendistancespan_bug.jsonld
new file mode 100644
index 0000000..7e442f8
--- /dev/null
+++ b/src/test/resources/queries/bugs/tokendistancespan_bug.jsonld
@@ -0,0 +1,109 @@
+{
+ "@context":"http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
+ "errors":[],
+ "warnings":[],
+ "messages":[
+ [303,"Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date."],
+ [303,"Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date."]
+ ],
+ "collection":{},
+ "query":{
+ "@type":"koral:group",
+ "operation":"operation:disjunction",
+ "operands":[
+ {
+ "@type":"koral:group",
+ "operation":"operation:class",
+ "classOut":1,
+ "operands":[
+ {
+ "@type":"koral:group",
+ "operation":"operation:sequence",
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"Mensch",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"Stelle",
+ "match":"match:eq"
+ }
+ }
+ ],
+ "inOrder":true,
+ "distances":[
+ {
+ "@type":"koral:distance",
+ "key":"w",
+ "boundary":{
+ "@type":"koral:boundary",
+ "min":0
+ },
+ "min":0
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "@type":"koral:group",
+ "operation":"operation:class",
+ "classOut":2,
+ "operands":[
+ {
+ "@type":"koral:group",
+ "operation":"operation:sequence",
+ "operands":[
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"Stelle",
+ "match":"match:eq"
+ }
+ },
+ {
+ "@type":"koral:token",
+ "wrap":{
+ "@type":"koral:term",
+ "layer":"orth",
+ "key":"Mensch",
+ "match":"match:eq"
+ }
+ }
+ ],
+ "inOrder":true,
+ "distances":[
+ {
+ "@type":"koral:distance",
+ "key":"w",
+ "boundary":{
+ "@type":"koral:boundary",
+ "min":0
+ },
+ "min":0
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "meta":{
+ "highlight":[1,2],
+ "startPage":1,
+ "count":25,
+ "cutOff":true,
+ "context":"base/s:p"
+ }
+}