use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithDimensionsPlacementAndProvider.
@Test
public void testSearchWithDimensionsPlacementAndProvider() {
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.marketDimension, "total_market", 186));
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).dimensions(Arrays.asList(QueryRunnerTestHelper.placementishDimension, QueryRunnerTestHelper.marketDimension)).intervals(QueryRunnerTestHelper.fullOnInterval).query("mark").build(), expectedHits);
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithDimensionsQualityAndProvider.
@Test
public void testSearchWithDimensionsQualityAndProvider() {
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "automotive", 93));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "mezzanine", 279));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "travel", 93));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "health", 93));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "entertainment", 93));
expectedHits.add(new SearchHit(QueryRunnerTestHelper.marketDimension, "total_market", 186));
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).dimensions(Arrays.asList(QueryRunnerTestHelper.qualityDimension, QueryRunnerTestHelper.marketDimension)).intervals(QueryRunnerTestHelper.fullOnInterval).query("a").build(), expectedHits);
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithExtractionFilter1.
@Test
public void testSearchWithExtractionFilter1() {
final String automotiveSnowman = "automotive☃";
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, automotiveSnowman, 93));
final LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(new MapLookupExtractor(ImmutableMap.of("automotive", automotiveSnowman), false), true, null, true, true);
SearchQuery query = Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).filters(new ExtractionDimFilter(QueryRunnerTestHelper.qualityDimension, automotiveSnowman, lookupExtractionFn, null)).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(new ExtractionDimensionSpec(QueryRunnerTestHelper.qualityDimension, null, lookupExtractionFn)).query("☃").build();
checkSearchQuery(query, expectedHits);
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithFilterEmptyResults.
@Test
public void testSearchWithFilterEmptyResults() {
List<SearchHit> expectedHits = Lists.newLinkedList();
DimFilter filter = Druids.newAndDimFilterBuilder().fields(Arrays.<DimFilter>asList(Druids.newSelectorDimFilterBuilder().dimension(QueryRunnerTestHelper.marketDimension).value("total_market").build(), Druids.newSelectorDimFilterBuilder().dimension(QueryRunnerTestHelper.qualityDimension).value("automotive").build())).build();
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).filters(filter).intervals(QueryRunnerTestHelper.fullOnInterval).query("a").build(), expectedHits);
}
use of io.druid.query.search.search.SearchHit in project druid by druid-io.
the class SearchQueryRunnerTest method testSearchWithSingleFilter1.
@Test
public void testSearchWithSingleFilter1() {
List<SearchHit> expectedHits = Lists.newLinkedList();
expectedHits.add(new SearchHit(QueryRunnerTestHelper.qualityDimension, "mezzanine", 93));
checkSearchQuery(Druids.newSearchQueryBuilder().dataSource(QueryRunnerTestHelper.dataSource).granularity(QueryRunnerTestHelper.allGran).filters(new AndDimFilter(Arrays.<DimFilter>asList(new SelectorDimFilter(QueryRunnerTestHelper.marketDimension, "total_market", null), new SelectorDimFilter(QueryRunnerTestHelper.qualityDimension, "mezzanine", null)))).intervals(QueryRunnerTestHelper.fullOnInterval).dimensions(QueryRunnerTestHelper.qualityDimension).query("a").build(), expectedHits);
}
Aggregations