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

This commit is contained in:
yonik 2017-11-16 12:28:01 -05:00
parent 96af869da3
commit c561ffe635
3 changed files with 20 additions and 0 deletions

View File

@ -110,6 +110,9 @@ Bug Fixes
* SOLR-11231: Guard against unset fields when performing language detection. * SOLR-11231: Guard against unset fields when performing language detection.
(Chris Beer via Steve Rowe) (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 Optimizations
---------------------- ----------------------
* SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr

View File

@ -101,6 +101,11 @@ public class FacetField extends FacetRequestSorted {
if (fcontext.facetInfo != null) { if (fcontext.facetInfo != null) {
// refinement... we will end up either skipping the entire facet, or doing calculating only specific facet buckets // 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); return new FacetFieldProcessorByArrayDV(fcontext, this, sf);
} }

View File

@ -603,4 +603,16 @@ public class UnInvertedField extends DocTermOrds {
return uif; 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;
}
} }