NextSpan with LeftExpansion broken test case. Please do not merge.
Change-Id: If6c6cde2ddeff1d60837f59c45ead047f6d5d7e5
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
index 7a19b66..e1be8c3 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
@@ -123,6 +123,43 @@
}
@Test
+ public void testNextRightExpansion () throws IOException {
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(simpleFieldDoc("F u G S h A d F ü d T F u d m", " "));
+ ki.commit();
+
+ SpanTermQuery stq = new SpanTermQuery(new Term("base", "s:d"));
+ SpanExpansionQuery seq = new SpanExpansionQuery(stq, 0, 6, 0, true);
+ SpanNextQuery snq = new SpanNextQuery(seq,stq);
+ assertEquals("spanNext(spanExpansion(base:s:d, []{0, 6}, right), base:s:d)", snq.toString());
+ Result kr = ki.search(snq, (short) 10);
+
+// 6,10 FuGShA[[dFüd]]TFudm
+// 6,14 FuGShA[[dFüdTFud]]m
+// 9,14 ... ShAdFü[[dTFud]]
+ assertEquals(3, kr.getTotalResults());
+ }
+
+ @Test
+ public void testNextLeftExpansion () throws IOException {
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(simpleFieldDoc("F u G S h A d F ü d T F u d m", " "));
+ ki.commit();
+
+ SpanTermQuery stq = new SpanTermQuery(new Term("base", "s:d"));
+ SpanExpansionQuery seq = new SpanExpansionQuery(stq, 0, 6, -1, true);
+ SpanNextQuery snq = new SpanNextQuery(stq,seq);
+ assertEquals("spanNext(base:s:d, spanExpansion(base:s:d, []{0, 6}, left))", snq.toString());
+ Result kr = ki.search(snq, (short) 10);
+
+ for (Match km : kr.getMatches()) {
+ System.out.println(km.getStartPos() + "," + km.getEndPos() + " " +
+ km.getSnippetBrackets()); }
+
+ assertEquals(3, kr.getTotalResults());
+ }
+
+ @Test
public void indexExample1 () throws IOException {
KrillIndex ki = new KrillIndex();