Added test for wildcards without foundry information
Change-Id: Ifce5508b88dfdb7458c028238dbbb6041eb8b0db
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
index 85adfb7..2c5bd7f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
@@ -256,6 +256,27 @@
assertEquals(6, kr.getMatches().size());
}
+
+ @Test
+ public void queryJSONwildcardNoFoundry () throws QueryException, IOException {
+ // meine*
+ ki = new KrillIndex();
+ ki.addDoc(createFieldDoc5());
+ ki.commit();
+
+ // treat merging gracefully
+ SpanQueryWrapper sqw = getJSONQuery(
+ getClass().getResource("/queries/bugs/cosmas_wildcards_missingfoundry.jsonld")
+ .getFile());
+ SpanQuery sq = sqw.toQuery();
+ assertEquals(sq.toString(),"SpanMultiTermQueryWrapper(tokens:l:Erfahr*)");
+
+ kr = ki.search(sq, (short) 10);
+ assertEquals(4, kr.getMatches().size());
+ assertEquals(1, kr.getMatch(0).getStartPos());
+ assertEquals(2, kr.getMatch(0).getEndPos());
+ };
+
@Test
@Ignore
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index 34fb3f1..02615fe 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -611,8 +611,6 @@
"spanNext(tokens:s:der, tokens:s:Baum)");
assertEquals(kq.getWarning(0).getCode(), 774);
};
-
-
public static String getString (String path) {
diff --git a/src/test/resources/queries/bugs/cosmas_wildcards_missingfoundry.jsonld b/src/test/resources/queries/bugs/cosmas_wildcards_missingfoundry.jsonld
new file mode 100644
index 0000000..0a69512
--- /dev/null
+++ b/src/test/resources/queries/bugs/cosmas_wildcards_missingfoundry.jsonld
@@ -0,0 +1,14 @@
+{
+ "@context": "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld",
+ "query": {
+ "@type" : "koral:token",
+ "wrap" : {
+ "@type":"koral:term",
+ "layer": "lemma",
+ "match":"match:eq",
+ "type":"type:wildcard",
+ "key":"Erfahr*"
+ }
+ }
+}
+