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 2017/11/16 17:28:44 UTC

lucene-solr:branch_7x: SOLR-11553: fix refinement to pick right processor / uninversion mechanism

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x a44afc55a -> cf2e4d7dc


SOLR-11553: fix refinement to pick right processor / uninversion mechanism


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

Branch: refs/heads/branch_7x
Commit: cf2e4d7dced9905795350d41c2fd4470be00fced
Parents: a44afc5
Author: yonik <yo...@apache.org>
Authored: Thu Nov 16 12:28:01 2017 -0500
Committer: yonik <yo...@apache.org>
Committed: Thu Nov 16 12:28:36 2017 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                        |  3 +++
 .../java/org/apache/solr/search/facet/FacetField.java   |  5 +++++
 .../org/apache/solr/search/facet/UnInvertedField.java   | 12 ++++++++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cf2e4d7d/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b99bf28..0607237 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -94,6 +94,9 @@ Bug Fixes
 * SOLR-11231: Guard against unset fields when performing language detection.
   (Chris Beer via Steve Rowe)
 
+* SOLR-11553: JSON Facet API: facet refinement could use UIF in phase one and DV uninversion in phase 2, resulting
+  in too much memory use. (yonik)
+
 Optimizations
 ----------------------
 * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cf2e4d7d/solr/core/src/java/org/apache/solr/search/facet/FacetField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetField.java b/solr/core/src/java/org/apache/solr/search/facet/FacetField.java
index 578994f..1a59549 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/FacetField.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetField.java
@@ -101,6 +101,11 @@ public class FacetField extends FacetRequestSorted {
 
     if (fcontext.facetInfo != null) {
       // refinement... we will end up either skipping the entire facet, or doing calculating only specific facet buckets
+      if (multiToken && !sf.hasDocValues() && method!=FacetMethod.DV) {
+        // Match the access method from the first phase.
+        // It won't always matter, but does currently for an all-values bucket
+        return new FacetFieldProcessorByArrayUIF(fcontext, this, sf);
+      }
       return new FacetFieldProcessorByArrayDV(fcontext, this, sf);
     }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cf2e4d7d/solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java b/solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java
index 1754175..c9f3b0b 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java
@@ -603,4 +603,16 @@ public class UnInvertedField extends DocTermOrds {
 
     return uif;
   }
+
+  // Returns null if not already populated
+  public static UnInvertedField checkUnInvertedField(String field, SolrIndexSearcher searcher) throws IOException {
+    SolrCache<String, UnInvertedField> cache = searcher.getFieldValueCache();
+    if (cache == null) {
+      return null;
+    }
+    UnInvertedField uif = cache.get(field);  // cache is already synchronized, so no extra sync needed
+    // placeholder is an implementation detail, keep it hidden and return null if that is what we got
+    return uif==uifPlaceholder ? null : uif;
+  }
+
 }