Search in sources :

Example 16 with QueryBuilder

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

the class TestKrillQuery method KorapSequenceQuery8.

@Test
public void KorapSequenceQuery8() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.seq(kq.seg("try1")).append(kq.seg("try2")).append("try3").withConstraint(5, 6).withConstraint(2, 3, "s", true).toQuery();
    assertEquals("spanMultipleDistance(spanMultipleDistance(field:try1, field:try2, [(w[5:6], ordered, notExcluded), (s[2:3], ordered, excluded)]), field:try3, [(w[5:6], ordered, notExcluded), (s[2:3], ordered, excluded)])", sq.toString());
}
Also used : QueryBuilder(de.ids_mannheim.korap.query.QueryBuilder) SpanQuery(org.apache.lucene.search.spans.SpanQuery) Test(org.junit.Test)

Example 17 with QueryBuilder

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

the class TestKrillQuery method KorapShrinkQuery2.

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

Example 18 with QueryBuilder

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

the class TestKrillQuery method KorapTagQuery4.

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

Example 19 with QueryBuilder

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

the class TestKrillQuery method KorapShrinkQuery.

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

Example 20 with QueryBuilder

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

the class TestKrillQuery method KorapSequenceQuery4.

@Test
public void KorapSequenceQuery4() throws QueryException {
    QueryBuilder kq = new QueryBuilder("field");
    SpanQuery sq = kq.seq(kq.seg("try1")).append(kq.seg("try2")).withConstraint(2, 3, "s").withConstraint(5, 6, "w").toQuery();
    assertEquals("spanMultipleDistance(field:try1, field:try2, [(s[2:3], ordered, notExcluded), (w[5:6], ordered, notExcluded)])", 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