Search in sources :

Example 1 with RangeData

use of com.b2international.index.revision.RevisionFixtures.RangeData in project snow-owl by b2ihealthcare.

the class SingleDocumentRevisionIndexSearchTest method searchWithMatchRange.

@Test
public void searchWithMatchRange() throws Exception {
    final RangeData first = new RangeData(STORAGE_KEY1, "field1", "field2", null, 2, 4);
    final RangeData second = new RangeData(STORAGE_KEY2, "field1", "field2", null, 3, 5);
    indexRevision(MAIN, first, second);
    final Expression expression = Expressions.builder().filter(Expressions.matchRange("from", 2, 3)).filter(Expressions.matchRange("to", 3, 4)).build();
    final Query<RangeData> query = Query.select(RangeData.class).where(expression).build();
    final Iterable<RangeData> matches = search(MAIN, query);
    assertThat(matches).hasSize(1);
    assertThat(matches).containsOnly(first);
}
Also used : Expression(com.b2international.index.query.Expression) RangeData(com.b2international.index.revision.RevisionFixtures.RangeData) Test(org.junit.Test)

Aggregations

Expression (com.b2international.index.query.Expression)1 RangeData (com.b2international.index.revision.RevisionFixtures.RangeData)1 Test (org.junit.Test)1