You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2016/11/17 15:57:31 UTC

lucene-solr:branch_6x: SOLR-9772: reuse comparator when deriving fieldSortValues

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 4fedb640a -> e525cca01


SOLR-9772: reuse comparator when deriving fieldSortValues


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

Branch: refs/heads/branch_6x
Commit: e525cca0173c019448fd158b785aa8f4b06c1985
Parents: 4fedb64
Author: yonik <yo...@apache.org>
Authored: Thu Nov 17 10:56:37 2016 -0500
Committer: yonik <yo...@apache.org>
Committed: Thu Nov 17 10:57:02 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                          |  3 +++
 .../org/apache/solr/handler/component/QueryComponent.java | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e525cca0/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d54a677..0d9d198 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -75,6 +75,9 @@ Optimizations
 * SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method.
   (Jonny Marks via Christine Poerschke)
 
+* SOLR-9772: Deriving distributed sort values (fieldSortValues) should reuse
+  comparator and only invalidate leafComparator. (John Call via yonik)
+
 Bug Fixes
 ----------------------
 * SOLR-9701: NPE in export handler when "fl" parameter is omitted.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e525cca0/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index 83c6017..1e54262 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -617,7 +617,7 @@ public class QueryComponent extends SearchComponent
         // :TODO: would be simpler to always serialize every position of SortField[]
         if (type==SortField.Type.SCORE || type==SortField.Type.DOC) continue;
 
-        FieldComparator<?> comparator = null;
+        FieldComparator<?> comparator = sortField.getComparator(1,0);
         LeafFieldComparator leafComparator = null;
         Object[] vals = new Object[nDocs];
 
@@ -634,13 +634,13 @@ public class QueryComponent extends SearchComponent
             idx = ReaderUtil.subIndex(doc, leaves);
             currentLeaf = leaves.get(idx);
             if (idx != lastIdx) {
-              // we switched segments.  invalidate comparator.
-              comparator = null;
+              // we switched segments.  invalidate leafComparator.
+              lastIdx = idx;
+              leafComparator = null;
             }
           }
 
-          if (comparator == null) {
-            comparator = sortField.getComparator(1,0);
+          if (leafComparator == null) {
             leafComparator = comparator.getLeafComparator(currentLeaf);
           }