You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/12/06 23:13:26 UTC

[31/50] [abbrv] lucene-solr:apiv2: SOLR-9783: (Search|Top)Group[s]ShardResponseProcessor.process: turned sortWithinGroup null check into assert. Also sort.equals tweak in (grouping) QueryCommand.create method.

SOLR-9783: (Search|Top)Group[s]ShardResponseProcessor.process: turned sortWithinGroup null check into assert.
Also sort.equals tweak in (grouping) QueryCommand.create method.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/02c68775
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/02c68775
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/02c68775

Branch: refs/heads/apiv2
Commit: 02c687758e904ab92c2b766b2ec837bcb99f484f
Parents: 70b3589
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Nov 28 19:58:25 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Nov 29 14:37:12 2016 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                                 | 3 +++
 .../solr/search/grouping/distributed/command/QueryCommand.java   | 2 +-
 .../responseprocessor/SearchGroupShardResponseProcessor.java     | 4 +---
 .../responseprocessor/TopGroupsShardResponseProcessor.java       | 4 +---
 4 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/02c68775/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 422f1c6..cead9af 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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/02c68775/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java
----------------------------------------------------------------------
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 86fe729..afb8ba7 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<QueryCommandResult> {
 
   @Override
   public List<Collector> 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);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/02c68775/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java
----------------------------------------------------------------------
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 18b0de5..0acd6f9 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<String, List<Collection<SearchGroup<BytesRef>>>> commandSearchGroups = new HashMap<>(fields.length, 1.0f);
     final Map<String, Map<SearchGroup<BytesRef>, Set<String>>> tempSearchGroupToShards = new HashMap<>(fields.length, 1.0f);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/02c68775/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
----------------------------------------------------------------------
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 688a6c3..3610a38 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;