use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class AppendTest method testSearchWithOverlap.
@Test
public void testSearchWithOverlap() {
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
SearchQuery query = makeSearchQuery();
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment2);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchBenchmark method querySingleQueryableIndex.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndex(Blackhole blackhole) throws Exception {
final QueryRunner<Result<SearchResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex", new QueryableIndexSegment("qIndex", qIndexes.get(0)));
List<Result<SearchResultValue>> results = SearchBenchmark.runQuery(factory, runner, query);
List<SearchHit> hits = results.get(0).getValue().getValue();
for (SearchHit hit : hits) {
blackhole.consume(hit);
}
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class AppendTest method testSearch.
@Test
public void testSearch() {
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(qualityDimension, "automotive"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
SearchQuery query = makeSearchQuery();
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SchemalessTestSimpleTest method testFullOnSearch.
@Test
public void testFullOnSearch() {
SearchQuery query = Druids.newSearchQueryBuilder().dataSource(dataSource).granularity(allGran).intervals(fullOnInterval).query("a").build();
List<Result<SearchResultValue>> expectedResults = Arrays.asList(new Result<SearchResultValue>(new DateTime("2011-01-12T00:00:00.000Z"), new SearchResultValue(Arrays.<SearchHit>asList(new SearchHit(placementishDimension, "a"), new SearchHit(qualityDimension, "automotive"), new SearchHit(placementDimension, "mezzanine"), new SearchHit(marketDimension, "total_market")))));
QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment);
HashMap<String, Object> context = new HashMap<String, Object>();
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchAll.
@Test
public void testSearchAll() {
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.marketDimension, "spot", 837));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.marketDimension, "total_market", 186));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.marketDimension, "upfront", 186));
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(QueryRunnerTestHelper.marketDimension).query("").build(), expectedHits);
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(QueryRunnerTestHelper.marketDimension).build(), expectedHits);
}
Aggregations