Search in sources :

Example 11 with SpanSegmentQueryWrapper

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

the class TestSpanSegmentQuery method spanSegmentQuery.

@Test
public void spanSegmentQuery() throws QueryException {
    SpanSegmentQueryWrapper ssquery = new SpanSegmentQueryWrapper("field", "a");
    assertEquals("field:a", ssquery.toQuery().toString());
    ssquery = new SpanSegmentQueryWrapper("field", "a", "b");
    assertEquals("spanSegment(field:a, field:b)", ssquery.toQuery().toString());
    ssquery = new SpanSegmentQueryWrapper("field", "a", "b", "c");
    assertEquals("spanSegment(spanSegment(field:a, field:b), field:c)", ssquery.toQuery().toString());
}
Also used : SpanSegmentQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper) Test(org.junit.Test)

Example 12 with SpanSegmentQueryWrapper

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

the class TestSpanAlterQuery method spanAlterQuery4.

@Test
public void spanAlterQuery4() throws QueryException {
    SpanSegmentQueryWrapper segquery = new SpanSegmentQueryWrapper("field", "a", "b", "c");
    SpanAlterQueryWrapper ssaquery = new SpanAlterQueryWrapper("field");
    ssaquery.or("d").or(segquery).or("e");
    assertEquals("spanOr([field:d, spanSegment(spanSegment(field:a, field:b), field:c), field:e])", ssaquery.toQuery().toString());
}
Also used : SpanSegmentQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper) SpanAlterQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanAlterQueryWrapper) Test(org.junit.Test)

Example 13 with SpanSegmentQueryWrapper

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

the class TestSpanSegmentSequenceQuery method spanSegmentSequenceQueryPrepend2.

@Test
public void spanSegmentSequenceQueryPrepend2() throws QueryException {
    SpanSequenceQueryWrapper sssq = new SpanSequenceQueryWrapper("field", "d", "e");
    SpanSegmentQueryWrapper ssq = new SpanSegmentQueryWrapper("field", "-a", "-b", "-c");
    sssq.prepend(ssq);
    assertEquals("spanNext(spanNext(spanSegment(spanSegment(field:-a, field:-b), field:-c), field:d), field:e)", sssq.toQuery().toString());
}
Also used : SpanSegmentQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper) SpanSequenceQueryWrapper(de.ids_mannheim.korap.query.wrap.SpanSequenceQueryWrapper) Test(org.junit.Test)

Aggregations

SpanSegmentQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSegmentQueryWrapper)13 Test (org.junit.Test)11 SpanRegexQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRegexQueryWrapper)5 SpanAlterQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanAlterQueryWrapper)4 SpanSequenceQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanSequenceQueryWrapper)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 SpanQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanQueryWrapper)2 QueryException (de.ids_mannheim.korap.util.QueryException)2 KrillIndex (de.ids_mannheim.korap.KrillIndex)1 Test (de.ids_mannheim.korap.Test)1 MultiTerm (de.ids_mannheim.korap.index.MultiTerm)1 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)1 SpanRepetitionQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanRepetitionQueryWrapper)1 SpanWildcardQueryWrapper (de.ids_mannheim.korap.query.wrap.SpanWildcardQueryWrapper)1 Iterator (java.util.Iterator)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1 DirectoryReader (org.apache.lucene.index.DirectoryReader)1 IndexWriter (org.apache.lucene.index.IndexWriter)1 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)1 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)1