Changed the test document and updated testcases
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
index feb9fd9..e783540 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSubSpanIndex.java
@@ -9,6 +9,7 @@
import org.junit.Test;
import de.ids_mannheim.korap.KorapIndex;
+import de.ids_mannheim.korap.KorapMatch;
import de.ids_mannheim.korap.KorapResult;
import de.ids_mannheim.korap.query.DistanceConstraint;
import de.ids_mannheim.korap.query.SpanDistanceQuery;
@@ -23,39 +24,36 @@
@Test
public void testCase1() throws IOException {
ki = new KorapIndex();
- for (String i : new String[] {"AAA-12402"}) {
- ki.addDocFile(
- getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
- );
- };
+ ki.addDocFile(
+ getClass().getResource("/wiki/00001.json.gz").getFile(),true);
ki.commit();
SpanDistanceQuery sdq = new SpanDistanceQuery(
- new SpanTermQuery(new Term("tokens","cnx/p:N")),
- new SpanTermQuery(new Term("tokens","cnx/p:V")),
+ new SpanTermQuery(new Term("tokens","tt/p:NN")),
+ new SpanTermQuery(new Term("tokens","tt/p:VAFIN")),
new DistanceConstraint(5, 5, true, false),
true);
SpanSubspanQuery ssq = new SpanSubspanQuery(sdq, 0, 2, true);
kr = ki.search(ssq, (short) 10);
- assertEquals(27,kr.getTotalResults());
- assertEquals(30, kr.getMatch(0).getStartPos());
- assertEquals(32, kr.getMatch(0).getEndPos());
- assertEquals(81, kr.getMatch(1).getStartPos());
- assertEquals(83, kr.getMatch(1).getEndPos());
-
- /*for (KorapMatch km : kr.getMatches()){
- System.out.println(km.getStartPos() +","+km.getEndPos()
- +km.getSnippetBrackets());
- }*/
+ assertEquals(8,kr.getTotalResults());
+ assertEquals(35, kr.getMatch(0).getStartPos());
+ assertEquals(37, kr.getMatch(0).getEndPos());
+ assertEquals(179, kr.getMatch(1).getStartPos());
+ assertEquals(181, kr.getMatch(1).getEndPos());
ssq = new SpanSubspanQuery(sdq, -2, 2, true);
kr = ki.search(ssq, (short) 10);
- assertEquals(34, kr.getMatch(0).getStartPos());
- assertEquals(36, kr.getMatch(0).getEndPos());
- assertEquals(85, kr.getMatch(1).getStartPos());
- assertEquals(87, kr.getMatch(1).getEndPos());
+ assertEquals(39, kr.getMatch(0).getStartPos());
+ assertEquals(41, kr.getMatch(0).getEndPos());
+ assertEquals(183, kr.getMatch(1).getStartPos());
+ assertEquals(185, kr.getMatch(1).getEndPos());
+
+ for (KorapMatch km : kr.getMatches()){
+ System.out.println(km.getStartPos() +","+km.getEndPos()
+ +km.getSnippetBrackets());
+ }
}
}