lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [09/20] lucene-solr:jira/solr-8593: SOLR-9772: reuse comparator when deriving fieldSortValues
Date Fri, 18 Nov 2016 16:42:34 GMT
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/738198ef
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/738198ef
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/738198ef

Branch: refs/heads/jira/solr-8593
Commit: 738198ef34b694a2a3ff8d48d5ae8a50ca34c803
Parents: f9a0693
Author: yonik <yonik@apache.org>
Authored: Thu Nov 17 10:56:37 2016 -0500
Committer: yonik <yonik@apache.org>
Committed: Thu Nov 17 10:56:37 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/738198ef/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 00c0669..56c491c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -128,6 +128,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/738198ef/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 c0484ec..9823f3d 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
@@ -616,7 +616,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];
 
@@ -633,13 +633,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);
           }
 


Mime
View raw message