Package org.apache.solr.search.facet
Class FacetRequest
- java.lang.Object
-
- org.apache.solr.search.facet.FacetRequest
-
- Direct Known Subclasses:
FacetField
,FacetHeatmap
,FacetQuery
,FacetRange
public abstract class FacetRequest extends Object
A request to do facets/stats that might itself be composed of sub-FacetRequests. This is a cornerstone of the facet module.- See Also:
parse(SolrQueryRequest, Map)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FacetRequest.Domain
static class
FacetRequest.FacetSort
Simple structure for encapsulating a sort variable and a directionstatic class
FacetRequest.RefineMethod
static class
FacetRequest.SortDirection
-
Field Summary
Fields Modifier and Type Field Description protected FacetRequest.Domain
domain
protected Map<String,AggValueSource>
facetStats
protected boolean
processEmpty
protected Map<String,FacetRequest>
subFacets
-
Constructor Summary
Constructors Constructor Description FacetRequest()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addStat(String key, AggValueSource stat)
void
addSubFacet(String key, FacetRequest facetRequest)
boolean
canProduceFromEmpty()
Returns true if this facet, or any sub-facets can produce results from an empty domain.abstract FacetMerger
createFacetMerger(Object prototype)
abstract FacetProcessor<? extends FacetRequest>
createFacetProcessor(FacetContext fcontext)
boolean
doRefine()
abstract Map<String,Object>
getFacetDescription()
Map<String,AggValueSource>
getFacetStats()
FacetRequest.RefineMethod
getRefineMethod()
Returns null if unsetMap<String,FacetRequest>
getSubFacets()
static FacetRequest
parse(SolrQueryRequest req, Map<String,Object> params)
Factory method to parse a facet request tree.static FacetRequest
parseOneFacetReq(SolrQueryRequest req, Map<String,Object> params)
Factory method to parse out a rooted facet request tree that would normally go one level below a label.Object
process(SolrQueryRequest req, DocSet domain)
Process this facet request against the given domain of docs.boolean
returnsPartial()
Returns true if this facet can return just some of the facet buckets that match all the criteria.String
toString()
-
-
-
Field Detail
-
facetStats
protected Map<String,AggValueSource> facetStats
-
subFacets
protected Map<String,FacetRequest> subFacets
-
processEmpty
protected boolean processEmpty
-
domain
protected FacetRequest.Domain domain
-
-
Method Detail
-
parse
public static FacetRequest parse(SolrQueryRequest req, Map<String,Object> params)
Factory method to parse a facet request tree. The outer keys are arbitrary labels and their values are facet request specifications. Will throw aSolrException
if it fails to parse.- Parameters:
req
- the overall requestparams
- a typed parameter structure (unlike SolrParams which are all string values).
-
parseOneFacetReq
public static FacetRequest parseOneFacetReq(SolrQueryRequest req, Map<String,Object> params)
Factory method to parse out a rooted facet request tree that would normally go one level below a label. The params must contain a "type". This is intended to be useful externally, such as bySimpleFacets
.- Parameters:
req
- the overall requestparams
- a typed parameter structure (unlike SolrParams which are all string values).
-
getFacetStats
public Map<String,AggValueSource> getFacetStats()
-
getSubFacets
public Map<String,FacetRequest> getSubFacets()
-
getRefineMethod
public FacetRequest.RefineMethod getRefineMethod()
Returns null if unset
-
doRefine
public boolean doRefine()
-
returnsPartial
public boolean returnsPartial()
Returns true if this facet can return just some of the facet buckets that match all the criteria. This is normally true only for facets with a limit.
-
canProduceFromEmpty
public boolean canProduceFromEmpty()
Returns true if this facet, or any sub-facets can produce results from an empty domain.
-
addStat
public void addStat(String key, AggValueSource stat)
-
addSubFacet
public void addSubFacet(String key, FacetRequest facetRequest)
-
process
public final Object process(SolrQueryRequest req, DocSet domain) throws IOException
Process this facet request against the given domain of docs. Note: this is currently used externally bySimpleFacets
.- Throws:
IOException
-
createFacetProcessor
public abstract FacetProcessor<? extends FacetRequest> createFacetProcessor(FacetContext fcontext)
-
createFacetMerger
public abstract FacetMerger createFacetMerger(Object prototype)
-
-