diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 422f1c658e4..cead9af537e 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -245,6 +245,9 @@ Other Changes * SOLR-9801: Upgrade jetty to 9.3.14.v20161028 (shalin) +* SOLR-9783: (Search|Top)Group[s]ShardResponseProcessor.process: turned sortWithinGroup null check into assert. + (Christine Poerschke) + ================== 6.3.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java index 86fe729447e..afb8ba78a9c 100644 --- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java +++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java @@ -124,7 +124,7 @@ public class QueryCommand implements Command { @Override public List create() throws IOException { - if (sort == null || sort == Sort.RELEVANCE) { + if (sort == null || sort.equals(Sort.RELEVANCE)) { collector = TopScoreDocCollector.create(docsToCollect); } else { collector = TopFieldCollector.create(sort, docsToCollect, true, needScores, needScores); diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java index 18b0de54a44..0acd6f90e27 100644 --- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java +++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java @@ -52,9 +52,7 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor Sort groupSort = rb.getGroupingSpec().getGroupSort(); final String[] fields = rb.getGroupingSpec().getFields(); Sort sortWithinGroup = rb.getGroupingSpec().getSortWithinGroup(); - if (sortWithinGroup == null) { // TODO prevent it from being null in the first place - sortWithinGroup = Sort.RELEVANCE; - } + assert sortWithinGroup != null; final Map>>> commandSearchGroups = new HashMap<>(fields.length, 1.0f); final Map, Set>> tempSearchGroupToShards = new HashMap<>(fields.length, 1.0f); diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java index 688a6c37011..3610a383ccb 100644 --- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java +++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java @@ -61,9 +61,7 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor { String[] fields = rb.getGroupingSpec().getFields(); String[] queries = rb.getGroupingSpec().getQueries(); Sort sortWithinGroup = rb.getGroupingSpec().getSortWithinGroup(); - if (sortWithinGroup == null) { // TODO prevent it from being null in the first place - sortWithinGroup = Sort.RELEVANCE; - } + assert sortWithinGroup != null; // If group.format=simple group.offset doesn't make sense int groupOffsetDefault;