You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2016/11/07 18:49:35 UTC

lucene-solr:branch_6x: SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method. (Jonny Marks via Christine Poerschke)

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x fb83d64ea -> 1c7ae9215


SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method. (Jonny Marks via Christine Poerschke)


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

Branch: refs/heads/branch_6x
Commit: 1c7ae9215cbb276a89ae17fd95a43c54ef582a68
Parents: fb83d64
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Nov 7 16:06:25 2016 +0000
Committer: Christine Poerschke <cp...@apache.org>
Committed: Mon Nov 7 18:35:30 2016 +0000

----------------------------------------------------------------------
 solr/CHANGES.txt                                       |  3 +++
 .../java/org/apache/solr/request/DocValuesFacets.java  | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1c7ae921/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f3230c8..82f54be 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -55,6 +55,9 @@ Optimizations
 * SOLR-9704: Facet Module / JSON Facet API: Optimize blockChildren facets that have
   filters specified by using those filters as acceptDocs. (yonik)
 
+* SOLR-9726: Reduce number of lookupOrd calls made by the DocValuesFacets.getCounts method.
+  (Jonny Marks via Christine Poerschke)
+
 Bug Fixes
 ----------------------
 * SOLR-9701: NPE in export handler when "fl" parameter is omitted.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1c7ae921/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java b/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
index 77cc90e..bcabffa 100644
--- a/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/DocValuesFacets.java
@@ -173,17 +173,18 @@ public class DocValuesFacets {
         int min=mincount-1;  // the smallest value in the top 'N' values
         for (int i=(startTermIndex==-1)?1:0; i<nTerms; i++) {
           int c = counts[i];
-          if (contains != null) {
-            final BytesRef term = si.lookupOrd(startTermIndex+i);
-            if (!SimpleFacets.contains(term.utf8ToString(), contains, ignoreCase)) {
-              continue;
-            }
-          }
           if (c>min) {
             // NOTE: we use c>min rather than c>=min as an optimization because we are going in
             // index order, so we already know that the keys are ordered.  This can be very
             // important if a lot of the counts are repeated (like zero counts would be).
 
+            if (contains != null) {
+              final BytesRef term = si.lookupOrd(startTermIndex+i);
+              if (!SimpleFacets.contains(term.utf8ToString(), contains, ignoreCase)) {
+                continue;
+              }
+            }
+
             // smaller term numbers sort higher, so subtract the term number instead
             long pair = (((long)c)<<32) + (Integer.MAX_VALUE - i);
             boolean displaced = queue.insert(pair);