What is the Facet Domain
The domain of a facet is the set of values (normally defined by a set of documents) that calculations will be done over. The root domain is the set of documents that match the base query and any filters.
Changing the Facet Domain
For any facet command, one can use the domain
keyword to change the facet domain before facet computation.
blockParent
The existence of the blockParent
parameter in the domain block will cause incoming child documents to be mapped to their parents.
The value of the blockParent parameter is the parent filter
that specifies the complete set of parent documents for this block join operation.
Nested Documents -> Faceting On Parents for an example.
blockChildren
The existence of the blockChildren
parameter in the domain block will cause incoming parent documents to be mapped to their children.
The value of the blockChildren parameter is the parent filter
that specifies the complete set of parent documents for this block join operation.
Nested Documents -> Faceting On Children for an example.
excludeTags
The excludeTags
parameter causes the domain to be re-calculated
from the root all the way to the current point, but excluding any filters with the specified tags.
This is normally used as part of multi-select faceting.
filter
The filter
parameter is used to specify a filter or list of filters to be intersected with the incoming domain before faceting. These filters are applied after other domain transformations such as blockParent, blockChildren, or excludeTags.
The same exact syntax for filter
is supported in the JSON Request API for the top level document list (or will be after SOLR-9733).
Example:
json.facet = { categories : { type : terms, field : cat, domain : { filter:"user:yonik" } } }
The “param” query type can be used to grab zero or more filters from a request parameter:
q=my query& myfilt=type:review& myfilt=rating:5& json.facet = { categories : { type : terms, field : cat, domain : { filter:[ "user:yonik", {param : myfilt} ] } } }