Failing test for left expansion queries with wrong ordering
Change-Id: I30fbdbf851891e170d8b3b76f8b62fc2f0974bc0
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 118dc2c..0b4c4b8 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;
@@ -568,6 +569,32 @@
assertEquals((long) 1, kr.getTotalResults());
};
+
+ @Test
+ @Ignore
+ public void indexExpansionLeftWithWrongSorting () throws IOException {
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(simpleFieldDoc("abcc"));
+ ki.commit();
+
+ SpanTermQuery stq = new SpanTermQuery(new Term("base", "s:c"));
+ SpanExpansionQuery seq = new SpanExpansionQuery(stq, 0, 2, -1, true);
+ assertEquals("spanExpansion(base:s:c, []{0, 2}, left)", seq.toString());
+ Result kr = ki.search(seq, (short) 10);
+
+ /*
+ for (Match km : kr.getMatches()) {
+ System.out.println(km.getStartPos() + "," + km.getEndPos() + " " +
+ km.getSnippetBrackets());
+ };
+ */
+
+ assertEquals(kr.getMatch(1).getSnippetBrackets(), "a[[bc]]c");
+ assertEquals(kr.getMatch(2).getSnippetBrackets(), "a[[bcc]]");
+ assertEquals(6, kr.getTotalResults());
+ }
+
+
private FieldDocument createFieldDoc6 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-6");