Class FacetComponent.FacetContext
java.lang.Object
org.apache.solr.handler.component.FacetComponent.FacetContext
- Enclosing class:
FacetComponent
Encapsulates facet ranges and facet queries such that their parameters are parsed and cached
for efficient re-use.
An instance of this class is initialized and kept in the request context via the static
method initContext(ResponseBuilder) and
can be retrieved via getFacetContext(SolrQueryRequest)
This class is used exclusively in a single-node context (i.e. non distributed requests or an
individual shard request). Also see FacetComponent.FacetInfo which is dedicated exclusively for
merging responses from multiple shards and plays no role during computation of facet counts in
a single node request.
This API is experimental and subject to change
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic FacetComponent.FacetContextReturn theFacetComponent.FacetContextinstance cached in the request context.static voidInitializes FacetContext using request parameters and saves it in the request context which can be retrieved viagetFacetContext(SolrQueryRequest)
-
Method Details
-
initContext
Initializes FacetContext using request parameters and saves it in the request context which can be retrieved viagetFacetContext(SolrQueryRequest)- Parameters:
rb- the ResponseBuilder object from which the request parameters are read and to which the FacetContext object is saved.
-
getFacetContext
public static FacetComponent.FacetContext getFacetContext(SolrQueryRequest req) throws IllegalStateException Return theFacetComponent.FacetContextinstance cached in the request context.- Parameters:
req- theSolrQueryRequest- Returns:
- the cached FacetContext instance
- Throws:
IllegalStateException- if no cached FacetContext instance is found in the request context
-
getAllRangeFacetRequests
- Returns:
- a
ListofRangeFacetRequestobjects each representing a facet.range to be computed. Returns an empty list if no facet.range were requested.
-
getAllQueryFacets
- Returns:
- a
ListofFacetComponent.FacetBaseobjects each representing a facet.query to be computed. Returns an empty list of no facet.query were requested.
-
getRangeFacetRequestsForTag
- Parameters:
tag- a String tag usually specified via local param on a facet.pivot- Returns:
- a list of
RangeFacetRequestobjects which have been tagged with the given tag. Returns an empty list if none found.
-
getQueryFacetsForTag
- Parameters:
tag- a String tag usually specified via local param on a facet.pivot- Returns:
- a list of
FacetComponent.FacetBaseobjects which have been tagged with the given tag. Returns and empty List if none found.
-