You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2016/11/10 21:15:43 UTC
[13/36] lucene-solr:jira/solr-8593: SOLR-9726: Reduce number of
lookupOrd calls made by the DocValuesFacets.getCounts method. (Jonny Marks
via Christine Poerschke)
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/cbf8235e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cbf8235e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cbf8235e
Branch: refs/heads/jira/solr-8593
Commit: cbf8235e570c8f10f42eb1240f7e0d5918e7025c
Parents: 7fb72bf
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 16:06:25 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/cbf8235e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ad022fb..bb49a69 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -109,6 +109,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/cbf8235e/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 0dab34b..3714bf1 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);