Search in sources :

Example 16 with SearchSortSpec

use of io.druid.query.search.search.SearchSortSpec in project druid by druid-io.

the class SearchBinaryFnTest method testMergeLimit.

@Test
public void testMergeLimit() {
    Result<SearchResultValue> r1 = new Result<SearchResultValue>(currTime, new SearchResultValue(ImmutableList.<SearchHit>of(new SearchHit("blah", "foo"))));
    Result<SearchResultValue> r2 = new Result<SearchResultValue>(currTime, new SearchResultValue(ImmutableList.<SearchHit>of(new SearchHit("blah2", "foo2"))));
    Result<SearchResultValue> expected = r1;
    Result<SearchResultValue> actual = new SearchBinaryFn(new SearchSortSpec(StringComparators.LEXICOGRAPHIC), Granularities.ALL, 1).apply(r1, r2);
    Assert.assertEquals(expected.getTimestamp(), actual.getTimestamp());
    assertSearchMergeResult(expected.getValue(), actual.getValue());
}
Also used : SearchHit(io.druid.query.search.search.SearchHit) SearchSortSpec(io.druid.query.search.search.SearchSortSpec) Result(io.druid.query.Result) Test(org.junit.Test)

Example 17 with SearchSortSpec

use of io.druid.query.search.search.SearchSortSpec in project druid by druid-io.

the class SearchBinaryFnTest method testMerge.

@Test
public void testMerge() {
    Result<SearchResultValue> r1 = new Result<SearchResultValue>(currTime, new SearchResultValue(ImmutableList.<SearchHit>of(new SearchHit("blah", "foo"))));
    Result<SearchResultValue> r2 = new Result<SearchResultValue>(currTime, new SearchResultValue(ImmutableList.<SearchHit>of(new SearchHit("blah2", "foo2"))));
    Result<SearchResultValue> expected = new Result<SearchResultValue>(currTime, new SearchResultValue(ImmutableList.<SearchHit>of(new SearchHit("blah", "foo"), new SearchHit("blah2", "foo2"))));
    Result<SearchResultValue> actual = new SearchBinaryFn(new SearchSortSpec(StringComparators.LEXICOGRAPHIC), Granularities.ALL, Integer.MAX_VALUE).apply(r1, r2);
    Assert.assertEquals(expected.getTimestamp(), actual.getTimestamp());
    assertSearchMergeResult(expected.getValue(), actual.getValue());
}
Also used : SearchHit(io.druid.query.search.search.SearchHit) SearchSortSpec(io.druid.query.search.search.SearchSortSpec) Result(io.druid.query.Result) Test(org.junit.Test)

Aggregations

SearchSortSpec (io.druid.query.search.search.SearchSortSpec)17 Test (org.junit.Test)17 SearchHit (io.druid.query.search.search.SearchHit)16 Result (io.druid.query.Result)10 SearchQuery (io.druid.query.search.search.SearchQuery)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)1