BlockJoin facets allow you to aggregate children facet counts by their parents.
It is a common requirement that if a parent document has several children documents, all of them need to increment facet value count only once. This functionality is provided by
BlockJoinFacetComponent just an alias for compatibility.
This functionality is considered deprecated. Users are encouraged to use
This example shows how you could add this search components to
solrconfig.xml and define it in request handler:
<searchComponent name="bjqFacetComponent" class="org.apache.solr.search.join.BlockJoinDocSetFacetComponent"/> <requestHandler name="/bjqfacet" class="org.apache.solr.handler.component.SearchHandler"> <lst name="defaults"> <str name="shards.qt">/bjqfacet</str> </lst> <arr name="last-components"> <str>bjqFacetComponent</str> </arr> </requestHandler>
This component can be added into any search request handler. This component work with distributed search in SolrCloud mode.
Documents should be added in children-parent blocks as described in indexing nested child documents. Examples:
Queries are constructed the same way as for a Parent Block Join query. For example:
As a result we should have facets for Red(1) and Blue(1), because matches on children
id=12 are aggregated into single hit into parent with
The key components of the request shown above are:
- The name of the request handler that has been defined with a block join facet component enabled.
- The mandatory parent query as a main query. The parent query could also be a subordinate clause in a more complex query.
- The child document field, which might be repeated many times with several fields, as necessary.