org.apache.lucene.sandbox.facet.utils (Lucene 10.5.0 sandbox API)
Description: declaration: package: org.apache.lucene.sandbox.facet.utils

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

package org.apache.lucene.sandbox.facet.utils
Sandbox faceting: utility classes to make it easier to use the new API for standard use cases.

Create a `FacetBuilder` for each facet request you have, use `FacetOrchestrator` or `DrillSidewaysFacetOrchestrator` to complete facet requests for a query, and call `FacetBuilder.getResult()` to get final results.

Which `FacetBuilder` to use?

- Use implementation specific to your use case, e.g. `TaxonomyFacetBuilder` for taxonomy fields (`FacetField`), `RangeFacetBuilderFactory` for range facets, `LongValueFacetBuilder` for numeric fields.
- Use `CommonFacetBuilder` for other cases where you can provide `FacetCutter` and `OrdToLabel`.

There is no implementation for your use case?

- Implement `FacetCutter`, `OrdToLabel` and/or `FacetRecorder` for your use case. See `org.apache.lucene.sandbox.facet` for low level API overview.
- Implement `FacetBuilder` for your use case unless `CommonFacetBuilder` is sufficient, or use low level API directly.

See SandboxFacetsExample for examples.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- Related Packages
  Package
  Description
  org.apache.lucene.sandbox.facet
  Sandbox faceting - Collectors that compute facets.
  org.apache.lucene.sandbox.facet.cutters
  Sandbox faceting: facet cutters, see `FacetCutter` for details.
  org.apache.lucene.sandbox.facet.iterators
  Sandbox faceting: facet ordinals.
  org.apache.lucene.sandbox.facet.labels
  Sandbox faceting: facet labels, see `OrdToLabel` for details.
  org.apache.lucene.sandbox.facet.recorders
  Sandbox faceting: classes that can record per ordinal data E.g.
- Class
  Description
  CommonFacetBuilder
  Common `FacetBuilder` that works with any `FacetCutter` and `OrdToLabel` provided by user.
  ComparableUtils
  Collection of static methods to provide most common comparables for sandbox faceting.
  ComparableUtils.ByAggregatedValueComparable
  Used for `ComparableUtils.byAggregatedValue(org.apache.lucene.sandbox.facet.recorders.CountFacetRecorder, org.apache.lucene.sandbox.facet.recorders.LongAggregationsFacetRecorder, int)` result.
  ComparableUtils.ByCountAndLongValueComparable
  Used for `ComparableUtils.byCount(CountFacetRecorder, LongValueFacetCutter)` result.
  ComparableUtils.ByCountComparable
  Used for `ComparableUtils.byCount(org.apache.lucene.sandbox.facet.recorders.CountFacetRecorder)` result.
  ComparableUtils.ByLongValueComparable
  Used for `ComparableUtils.byLongValue(org.apache.lucene.sandbox.facet.cutters.LongValueFacetCutter)` result.
  ComparableUtils.ByOrdinalComparable
  Used for `ComparableUtils.byOrdinal()` result.
  DrillSidewaysFacetOrchestrator
  Utility class to orchestrate `FacetBuilder`s to collect facets using `DrillSideways`.
  FacetBuilder
  End-to-end (request, collection and results) management of a single facet request.
  FacetOrchestrator
  Utility class to orchestrate `FacetBuilder`s to setup and exec collection for multiple facets.
  LongValueFacetBuilder
  `FacetBuilder` for distinct numeric field values.
  PostCollectionFaceting<C extends Collector,T,K extends Collector,R>
  Performs post-collection faceting by replaying collected documents through drill-down and drill-sideways collectors.
  PostCollectionFaceting.Result<T,R>
  The result.
  RangeFacetBuilderFactory
  `FacetBuilder` factory for faceting types base on numeric fields.
  TaxonomyFacetBuilder
  `FacetBuilder` for taxonomy facets.