SOLR-4717: SimpleFacets uses localParams (merge from 4x)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1468486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2013-04-16 16:13:44 +00:00
parent 51cbaae610
commit 4642adae86
3 changed files with 14 additions and 7 deletions

View File

@ -142,6 +142,8 @@ New Features
5.0) for basing the enumeration of cores. In the new way of doing things, a
core.propeties file will mark the instanceDir for that core, and instanceDir will
be obsolete as well
* SOLR-4717: SimpleFacets now work with localParams (ryan)
Bug Fixes

View File

@ -105,17 +105,18 @@ public class SimpleFacets {
/** The main set of documents all facet counts should be relative to */
protected DocSet docsOrig;
/** Configuration params behavior should be driven by */
protected SolrParams params;
protected SolrParams required;
protected final SolrParams orig;
protected final SolrParams required;
/** Searcher to use for all calculations */
protected SolrIndexSearcher searcher;
protected SolrQueryRequest req;
protected ResponseBuilder rb;
protected final SolrIndexSearcher searcher;
protected final SolrQueryRequest req;
protected final ResponseBuilder rb;
protected SimpleOrderedMap<Object> facetResponse;
// per-facet values
protected SolrParams localParams; // localParams on this particular facet command
protected SolrParams params; // local+original
protected String facetValue; // the field to or query to facet on (minus local params)
protected DocSet docs; // the base docset for this particular facet
protected String key; // what name should the results be stored under
@ -134,7 +135,7 @@ public class SimpleFacets {
this.req = req;
this.searcher = req.getSearcher();
this.docs = this.docsOrig = docs;
this.params = params;
this.params = orig = params;
this.required = new RequiredSolrParams(params);
this.rb = rb;
}
@ -147,7 +148,10 @@ public class SimpleFacets {
key = param;
threads = -1;
if (localParams == null) return;
if (localParams == null) {
return;
}
params = SolrParams.wrapDefaults(localParams, orig);
// remove local params unless it's a query
if (type != FacetParams.FACET_QUERY) { // TODO Cut over to an Enum here

View File

@ -27,6 +27,7 @@ import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.FacetParams;
import org.junit.After;
import org.junit.BeforeClass;