Search in sources :

Example 61 with QueryBuilder

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

the class TestKrillQuery method KorapWithinQuery1.

@Test
public void KorapWithinQuery1() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.contains(kq.seg("test"), kq.seg("test2")).toQuery();
    assertEquals("spanContain(field:test, field:test2)", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 62 with QueryBuilder

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

the class TestKrillQuery method KorapWithinQuery2.

@Test
public void KorapWithinQuery2() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.overlaps(kq.seg("test"), kq.seg("test2")).toQuery();
    assertEquals("spanOverlap(field:test, field:test2)", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 63 with QueryBuilder

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

the class TestKrillQuery method KorapClassQuery2.

@Test
public void KorapClassQuery2() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.nr(kq.seg("base:test")).toQuery();
    assertEquals("{1: field:base:test}", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 64 with QueryBuilder

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

the class TestKrillQuery method KorapClassQuery3.

@Test
public void KorapClassQuery3() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.seq(kq.seg("tree"), kq.contains(kq.tag("s"), kq.nr(kq.tag("np"))), kq.re("hey.*")).toQuery();
    assertEquals("spanNext(spanNext(field:tree, spanContain(<field:s />, {1: <field:np />})), SpanMultiTermQueryWrapper(field:/hey.*/))", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 65 with QueryBuilder

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

the class TestKrillQuery method KorapTagQuery5.

@Test
public void KorapTagQuery5() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.contains(kq.tag("s"), kq.tag("np")).toQuery();
    assertEquals("spanContain(<field:s />, <field:np />)", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Aggregations

QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)72 Test (org.junit.Test)67 SpanQuery (org.apache.lucene.search.spans.SpanQuery)39 KrillIndex (de.ids_mannheim.korap.KrillIndex)33 Result (de.ids_mannheim.korap.response.Result)32 Krill (de.ids_mannheim.korap.Krill)27 FieldDocument (de.ids_mannheim.korap.index.FieldDocument)14 SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)11 Match (de.ids_mannheim.korap.response.Match)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 KrillQuery (de.ids_mannheim.korap.KrillQuery)5 QueryException (de.ids_mannheim.korap.util.QueryException)5 KrillMeta (de.ids_mannheim.korap.KrillMeta)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 KrillCollection (de.ids_mannheim.korap.KrillCollection)3 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)3 CollectionBuilder (de.ids_mannheim.korap.collection.CollectionBuilder)3 SearchContext (de.ids_mannheim.korap.response.SearchContext)3 Test (de.ids_mannheim.korap.Test)2 DistanceConstraint (de.ids_mannheim.korap.query.DistanceConstraint)1