Added additional wildcard query test
Change-Id: I42bd2328f203f1b2267899c1cd10ff5f5962c968
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
index 7aff713..92fb038 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestIndex.java
@@ -191,7 +191,6 @@
return list;
};
-
@Test
public void indexLucene () throws Exception {
@@ -305,9 +304,6 @@
ssrquery = new SpanRegexQueryWrapper("text", "s:e.");
assertEquals(0, searcher.search(ssrquery.toQuery(), 10).totalHits);
- // Check http://comments.gmane.org/gmane.comp.jakarta.lucene.user/52283
- // for Carstens question on wildcards
-
// RegexpQuery
// All docs containing "E."/i ([Ee]r) (2x)
srquery = new RegexpQuery(new Term("text", "i:e."));
@@ -322,6 +318,15 @@
srquery = new RegexpQuery(new Term("text", "s:.*ng.*"));
assertEquals(2, searcher.search(srquery, 10).totalHits);
+
+ // Check http://comments.gmane.org/gmane.comp.jakarta.lucene.user/52283
+ // for Carstens question on wildcards
+ // Wildcardquery
+ // All docs containing ".{4}en" (liefen und Hunden)
+ WildcardQuery swquery = new WildcardQuery(new Term("text", "s:*ng*"));
+ assertEquals("text:s:*ng*", swquery.toString());
+ assertEquals(2, searcher.search(swquery, 10).totalHits);
+
// [base=angst]
SpanTermQuery stq = new SpanTermQuery(new Term("text", "l:angst"));
assertEquals(2, searcher.search(srquery, 10).totalHits);