Failing test for expansions with multiple starts at the same position
Change-Id: I5c09a3d4e9fa8763d2ea8879764ad323e57f0c8a
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
index d396815..edfc875 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
@@ -16,6 +16,7 @@
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.util.automaton.RegExp;
import org.junit.Test;
+import org.junit.Ignore;
import de.ids_mannheim.korap.Krill;
import de.ids_mannheim.korap.KrillIndex;
@@ -590,6 +591,52 @@
assertEquals(6, kr.getTotalResults());
}
+ @Test
+ @Ignore
+ public void indexExpansionMultipleStartsWithWrongSorting () throws IOException {
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(simpleFieldDoc("abccef"));
+ ki.commit();
+
+ SpanTermQuery stq = new SpanTermQuery(new Term("base", "s:c"));
+ SpanExpansionQuery seqL = new SpanExpansionQuery(stq, 0, 2, -1, true);
+ SpanExpansionQuery seqR = new SpanExpansionQuery(seqL, 0, 1, 0, true);
+ assertEquals(
+ "spanExpansion(spanExpansion(base:s:c, []{0, 2}, left), []{0, 1}, right)",
+ seqR.toString());
+ Result kr = ki.search(seqR, (short) 20);
+
+ /*
+ for (Match km : kr.getMatches()) {
+ System.out.println(km.getStartPos() + "," + km.getEndPos() + " " +
+ km.getSnippetBrackets());
+ };
+ */
+
+ // TODO: These are duplicate results that may be restricted with a wrapper
+ assertEquals("a[[bcc]]ef", kr.getMatch(3).getSnippetBrackets());
+ assertEquals("a[[bcc]]ef", kr.getMatch(4).getSnippetBrackets());
+ assertEquals(12, kr.getTotalResults());
+
+ stq = new SpanTermQuery(new Term("base", "s:c"));
+ seqL = new SpanExpansionQuery(stq, 0, 2, -1, true);
+ seqR = new SpanExpansionQuery(seqL, 0, 2, 0, true);
+ assertEquals(
+ "spanExpansion(spanExpansion(base:s:c, []{0, 2}, left), []{0, 2}, right)",
+ seqR.toString());
+ kr = ki.search(seqR, (short) 20);
+
+ /*
+ for (Match km : kr.getMatches()) {
+ System.out.println(km.getStartPos() + "," + km.getEndPos() + " " +
+ km.getSnippetBrackets());
+ };
+ */
+ assertEquals("a[[bcc]]ef", kr.getMatch(5).getSnippetBrackets());
+ assertEquals("a[[bcce]]f", kr.getMatch(6).getSnippetBrackets());
+ assertEquals(18, kr.getTotalResults());
+ }
+
/** Tests left expansion over start doc boundary. Redundant matches should
* be omitted.