Search in sources :

Example 71 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONkoralOptionalityAfterEmptyBug.

@Test
public void queryJSONkoralOptionalityAfterEmptyBug() throws QueryException {
    // Sonne [] Mond?
    SpanQueryWrapper sqwi = jsonQueryFile("empty-followed-by-optionality.jsonld");
    assertEquals("focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))", sqwi.toQuery().toString());
// Could also be a distance at the end ... that's a query planner thing.
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 72 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONkoralOptionalityInDistanceBug.

@Test
public void queryJSONkoralOptionalityInDistanceBug() {
    try {
        // Sonne [] Mond?
        SpanQueryWrapper sqwi = jsonQueryFile("distance-with-optionality.jsonld");
        sqwi.toQuery().toString();
    } catch (QueryException qe) {
        assertEquals("Distance constraints not supported with empty, optional or negative operands", qe.getMessage());
    }
// Could also be a distance at the end ... that's a query planner thing.
}
Also used : QueryException(de.ids_mannheim.korap.util.QueryException) SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 73 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONseqEmptyStart.

@Test
public void queryJSONseqEmptyStart() throws QueryException {
    SpanQueryWrapper sqwi = jsonQueryFile("empty-first.jsonld");
    // [][tt/p=NN]
    assertEquals(sqwi.toQuery().toString(), "spanExpansion(tokens:tt/p:NN, []{1, 1}, left)");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 74 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONseqNegativeEnd.

@Test
public void queryJSONseqNegativeEnd() throws QueryException {
    SpanQueryWrapper sqwi = jsonQueryFile("negative-last.jsonld");
    // [tt/p=NN][tt/p!=NN]
    assertEquals(sqwi.toQuery().toString(), "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:tt/p:NN, !tokens:tt/p:NN{1, 1}, right)}))");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Example 75 with SpanQueryWrapper

use of de.ids_mannheim.korap.query.wrap.SpanQueryWrapper in project Krill by KorAP.

the class TestSpanSequenceQueryJSON method queryJSONseqEmptyEnd.

@Test
public void queryJSONseqEmptyEnd() throws QueryException {
    SpanQueryWrapper sqwi = jsonQueryFile("empty-last.jsonld");
    assertEquals(sqwi.toQuery().toString(), "focus(254: spanContain(<tokens:base/s:t />, {254: spanExpansion(tokens:s:der, []{1, 1}, right)}))");
}
Also used : SpanQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanQueryWrapper) Test(org.junit.Test)

Aggregations

SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)165 Test (org.junit.Test)150 SpanQuery (org.apache.lucene.search.spans.SpanQuery)65 KrillIndex (de.ids_mannheim.korap.KrillIndex)17 QueryException (de.ids_mannheim.korap.util.QueryException)14 KrillQuery (de.ids_mannheim.korap.KrillQuery)13 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)11 Result (de.ids_mannheim.korap.response.Result)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)7 Krill (de.ids_mannheim.korap.Krill)5 SpanRepetitionQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRepetitionQueryWrapper)3 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)2 SpanClassQuery (de.ids_mannheim.korap.query.SpanClassQuery)2 SpanDistanceQuery (de.ids_mannheim.korap.query.SpanDistanceQuery)2 SpanWithinQuery (de.ids_mannheim.korap.query.SpanWithinQuery)2 SpanAlterQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanAlterQueryWrapper)2 SpanRegexQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRegexQueryWrapper)2 SpanSegmentQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper)2 Term (org.apache.lucene.index.Term)2 SpanOrQuery (org.apache.lucene.search.spans.SpanOrQuery)2