Class TermGroupFacetCollectorManager
- All Implemented Interfaces:
CollectorManager<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector,GroupedFacetResult>
CollectorManager for computing grouped facet counts based on term DocValues.
For each facet value, the result counts the number of distinct group values that have at least
one document with that facet value. Groups spanning multiple search slices are counted exactly
once (cross-slice deduplication is handled in reduce(java.util.Collection<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector>)).
When minCount is 0, zero-count facet terms are included in the result. Those
terms must be copied to BytesRef at LeafCollector.finish() time because reduce(java.util.Collection<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector>) no longer has access to per-segment DocValues. On a high-cardinality facet field this
can use substantially more memory than when minCount > 0, which only materializes terms
that were actually collected.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsConstructorDescriptionTermGroupFacetCollectorManager(String groupField, String facetField, boolean facetFieldMultivalued, BytesRef facetPrefix, int size, int minCount, boolean orderByCount) Creates a new TermGroupFacetCollectorManager. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollectorreduce(Collection<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector> collectors)
-
Constructor Details
-
TermGroupFacetCollectorManager
public TermGroupFacetCollectorManager(String groupField, String facetField, boolean facetFieldMultivalued, BytesRef facetPrefix, int size, int minCount, boolean orderByCount) Creates a new TermGroupFacetCollectorManager.- Parameters:
groupField- the group fieldfacetField- the facet fieldfacetFieldMultivalued- whether the facet field has multiple values per documentfacetPrefix- only include facet entries with this prefix; may be nullsize- the maximum number of facet entries to include in the result (offset + limit)minCount- minimum count for a facet entry to be included.0includes zero-count terms and materializes every in-range facet term (see class javadoc)orderByCount- whether to sort facet entries by count descending (vs. lexicographic)
-
-
Method Details
-
newCollector
public org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector newCollector()- Specified by:
newCollectorin interfaceCollectorManager<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector,GroupedFacetResult>
-
reduce
public GroupedFacetResult reduce(Collection<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector> collectors) throws IOException - Specified by:
reducein interfaceCollectorManager<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector,GroupedFacetResult> - Throws:
IOException
-