mirror of https://github.com/apache/druid.git
fix search with same value in multiple columns
This commit is contained in:
parent
3b29e77866
commit
75da039396
|
@ -41,7 +41,11 @@ public class LexicographicSearchSortSpec implements SearchSortSpec
|
|||
@Override
|
||||
public int compare(SearchHit searchHit, SearchHit searchHit1)
|
||||
{
|
||||
return searchHit.getValue().compareTo(searchHit1.getValue());
|
||||
int retVal = searchHit.getValue().compareTo(searchHit1.getValue());
|
||||
if (retVal == 0) {
|
||||
retVal = searchHit.getDimension().compareTo(searchHit1.getDimension());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -93,6 +93,29 @@ public class SearchQueryRunnerTest
|
|||
checkSearchQuery(searchQuery, expectedResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchSameValueInMultiDims()
|
||||
{
|
||||
SearchQuery searchQuery = Druids.newSearchQueryBuilder()
|
||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||
.granularity(QueryRunnerTestHelper.allGran)
|
||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||
.dimensions(
|
||||
Arrays.asList(
|
||||
QueryRunnerTestHelper.placementDimension,
|
||||
QueryRunnerTestHelper.placementishDimension
|
||||
)
|
||||
)
|
||||
.query("e")
|
||||
.build();
|
||||
|
||||
Map<String, Set<String>> expectedResults = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
|
||||
expectedResults.put(QueryRunnerTestHelper.placementDimension.toLowerCase(), Sets.newHashSet("preferred"));
|
||||
expectedResults.put(QueryRunnerTestHelper.placementishDimension, Sets.newHashSet("e", "preferred"));
|
||||
|
||||
checkSearchQuery(searchQuery, expectedResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFragmentSearch()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue