Class TermGroupFacetCollectorManager

java.lang.Object
org.apache.lucene.search.grouping.TermGroupFacetCollectorManager
All Implemented Interfaces:
CollectorManager<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector,GroupedFacetResult>

public class TermGroupFacetCollectorManager extends Object implements CollectorManager<org.apache.lucene.search.grouping.TermGroupFacetCollectorManager.FacetCollector,GroupedFacetResult>
A 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 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 field
      facetField - the facet field
      facetFieldMultivalued - whether the facet field has multiple values per document
      facetPrefix - only include facet entries with this prefix; may be null
      size - the maximum number of facet entries to include in the result (offset + limit)
      minCount - minimum count for a facet entry to be included. 0 includes 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