use of de.ids_mannheim.korap.KrillIndex in project Krill by KorAP.
the class TestUnorderedDistanceIndex method testCase2.
/**
* Multiple documents
* Ensure same doc
* Both candidate lists are empty, but there is a span left in the
* doc
* Both candidate lists are empty, but there are more matches in
* the doc
*
* @throws IOException
*/
@Test
public void testCase2() throws IOException {
// System.out.println("testcase 2");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = createQuery("s:c", "s:d", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 6);
}
use of de.ids_mannheim.korap.KrillIndex in project Krill by KorAP.
the class TestUnorderedDistanceIndex method testCase4.
/**
* Skip to
*/
@Test
public void testCase4() throws IOException {
// System.out.println("testcase 4");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.addDoc(createFieldDoc2());
ki.commit();
SpanQuery sq = new SpanNextQuery(createQuery("s:d", "s:e", 1, 2, false), new SpanTermQuery(new Term("base", "s:f")));
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 2);
assertEquals(2, kr.getMatch(0).getLocalDocID());
assertEquals(2, kr.getMatch(0).getStartPos());
assertEquals(6, kr.getMatch(0).getEndPos());
assertEquals(3, kr.getMatch(1).getStartPos());
assertEquals(6, kr.getMatch(1).getEndPos());
}
use of de.ids_mannheim.korap.KrillIndex in project Krill by KorAP.
the class TestUnorderedDistanceIndex method testCase7.
/**
* Nested distance queries
*/
@Test
public void testCase7() throws IOException {
// System.out.println("testcase 7");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = createQuery("s:c", "s:d", 1, 2, false);
SpanQuery sq2 = new SpanDistanceQuery(sq, new SpanTermQuery(new Term("base", "s:e")), new DistanceConstraint(1, 2, true, false), true);
kr = ki.search(sq2, (short) 10);
assertEquals(kr.getTotalResults(), 3);
assertEquals(5, kr.getMatch(0).getStartPos());
assertEquals(9, kr.getMatch(0).getEndPos());
assertEquals(1, kr.getMatch(1).getLocalDocID());
assertEquals(0, kr.getMatch(1).getStartPos());
assertEquals(3, kr.getMatch(1).getEndPos());
assertEquals(0, kr.getMatch(2).getStartPos());
assertEquals(4, kr.getMatch(2).getEndPos());
}
use of de.ids_mannheim.korap.KrillIndex in project Krill by KorAP.
the class TestUnorderedDistanceIndex method testCase8.
/**
* Multiple NextSpans in the same first span position
*/
@Test
public void testCase8() throws IOException {
ki = new KrillIndex();
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = new SpanNextQuery(new SpanTermQuery(new Term("base", "s:d")), createQuery("s:c", "s:e", 1, 2, false));
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 3);
assertEquals(0, kr.getMatch(1).getStartPos());
assertEquals(4, kr.getMatch(1).getEndPos());
}
use of de.ids_mannheim.korap.KrillIndex in project Krill by KorAP.
the class TestUnorderedElementDistanceIndex method testCase6.
/**
* Subspans occurrences are in the same positions.
*/
@Test
public void testCase6() throws IOException {
ki = new KrillIndex();
ki.addDoc(createFieldDoc5());
ki.commit();
SpanQuery sq = createQuery("s", "s:b", "s:e", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(8, kr.getTotalResults());
assertEquals(0, kr.getMatch(0).startPos);
assertEquals(3, kr.getMatch(0).endPos);
assertEquals(0, kr.getMatch(1).startPos);
assertEquals(5, kr.getMatch(1).endPos);
assertEquals(1, kr.getMatch(2).startPos);
assertEquals(3, kr.getMatch(2).endPos);
assertEquals(1, kr.getMatch(3).startPos);
assertEquals(4, kr.getMatch(3).endPos);
assertEquals(1, kr.getMatch(4).startPos);
assertEquals(5, kr.getMatch(4).endPos);
assertEquals(2, kr.getMatch(5).startPos);
assertEquals(7, kr.getMatch(5).endPos);
assertEquals(3, kr.getMatch(6).startPos);
assertEquals(5, kr.getMatch(6).endPos);
assertEquals(4, kr.getMatch(7).startPos);
assertEquals(7, kr.getMatch(7).endPos);
}
Aggregations