PostCollectionFaceting (Lucene 10.5.1 sandbox API)
Description: declaration: package: org.apache.lucene.sandbox.facet.utils, class: PostCollectionFaceting

Package org.apache.lucene.sandbox.facet.utils

# Class PostCollectionFaceting<C extends Collector,T,K extends Collector,R>

java.lang.Object
org.apache.lucene.sandbox.facet.utils.PostCollectionFaceting<C,T,K,R>

Type Parameters:
  `C` - drill-down collector type
  `T` - drill-down result type
  `K` - drill-sideways collector type
  `R` - drill-sideways result type

public final class PostCollectionFaceting<C extends Collector,T,K extends Collector,R> extends Object
Performs post-collection faceting by replaying collected documents through drill-down and drill-sideways collectors. This enables parallel facet computation after initial document collection.

Normally, users can collect facets directly during search without needing FacetsCollector to store doc IDs. However, this class implements the second step of two-step collection: iterating over doc IDs already collected in FacetsCollector to compute facet results. This approach is useful when all matches must be known before computing facets, or when reusing the same matching documents to run faceting multiple times.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final record`
  `PostCollectionFaceting.Result<T,R>`
  The result.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PostCollectionFaceting(CollectorManager<C,T> drillDownCollectorManager, Map<String,? extends CollectorManager<K,R>> drillSidewaysCollectorManagers, FacetsCollector drillDownFacetsCollector, Map<String,FacetsCollector> drillSidewaysFacetsCollectors, Executor executor)`
  Creates a new PostCollectionFaceting instance.
  `PostCollectionFaceting(CollectorManager<C,T> drillDownCollectorManager, FacetsCollector drillDownFacetsCollector, Executor executor)`
  Creates a new PostCollectionFaceting instance without drill-sideways collectors.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PostCollectionFaceting.Result<T,R>`
  `collect()`
  Collects facet results by replaying documents through collectors in parallel slices.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PostCollectionFaceting

    public PostCollectionFaceting(CollectorManager<C,T> drillDownCollectorManager, Map<String,? extends CollectorManager<K,R>> drillSidewaysCollectorManagers, FacetsCollector drillDownFacetsCollector, Map<String,FacetsCollector> drillSidewaysFacetsCollectors, Executor executor)
    Creates a new PostCollectionFaceting instance.
    Parameters:
      `drillDownCollectorManager` - collector manager for drill-down results
      `drillSidewaysCollectorManagers` - map of dimension names to collector managers for drill-sideways results
      `drillDownFacetsCollector` - facets collector containing drill-down matching documents
      `drillSidewaysFacetsCollectors` - map of dimension names to facets collectors for drill-sideways
      `executor` - executor for parallel processing, or null for sequential execution

  - ### PostCollectionFaceting

    public PostCollectionFaceting(CollectorManager<C,T> drillDownCollectorManager, FacetsCollector drillDownFacetsCollector, Executor executor)
    Creates a new PostCollectionFaceting instance without drill-sideways collectors.
    Parameters:
      `drillDownCollectorManager` - collector manager for drill-down results
      `drillDownFacetsCollector` - facets collector containing drill-down matching documents
      `executor` - executor for parallel processing, or null for sequential execution

- ## Method Details

  - ### collect

    public PostCollectionFaceting.Result<T,R> collect() throws IOException
    Collects facet results by replaying documents through collectors in parallel slices.
    Returns:
      result containing drill-down and drill-sideways facet results
    Throws:
      `IOException` - if an I/O error occurs during collection