Package org.apache.lucene.facet
This module provides multiple methods for computing facet counts and value aggregations:
- Taxonomy-based methods rely on a separate taxonomy index to map hierarchical facet paths to
global int ordinals for fast counting at search time; these methods can compute counts
((
FastTaxonomyFacetCounts) aggregate long or double valuesTaxonomyFacetIntAssociations,TaxonomyFacetFloatAssociations. AddFacetFieldorAssociationFacetFieldto your documents at index time to use taxonomy-based methods. - Sorted-set doc values method does not require a separate taxonomy index, and computes
counts based on sorted set doc values fields (
SortedSetDocValuesFacetCounts). AddSortedSetDocValuesFacetFieldto your documents at index time to use sorted set facet counts. - Range faceting
LongRangeFacetCounts,DoubleRangeFacetCountscompute counts for a dynamic numeric range from a providedLongValuesSource(previously indexed numeric field, or a dynamic expression such as distance).
At search time you first run your search, but pass a FacetsCollector to gather all hits (and optionally, scores for each
hit). Then, instantiate whichever facet methods you'd like to use to compute aggregates. Finally,
all methods implement a common Facets base API that you use to
obtain specific facet counts.
The various FacetsCollectorManager.search(org.apache.lucene.search.IndexSearcher, org.apache.lucene.search.Query, int, org.apache.lucene.facet.FacetsCollectorManager) utility methods are
useful for doing an "ordinary" search (sorting by score, or by a specified Sort) but also
collecting into a FacetsCollectorManager for subsequent faceting.
-
ClassDescriptionA
Queryfor drill-down over facet categories.Computes drill down and sideways counts for the providedDrillDownQuery.DrillSideways.Result<T,R> Base class for facet counts.Add an instance of this to yourDocumentfor every facet label.A termQueryover aFacetField.Counts or aggregates for a single dimension.Common base class for all facets implementations.Collects hits for subsequent faceting.Holds the documents that were matched in theLeafReaderContext.ACollectorManagerimplementation which produces FacetsCollector and produces a merged FacetsCollector.Holds results of a search run via static utility methods exposed by this class.Records per-dimension configuration.Holds the configuration for one dimensionDrill down terms indexing option to control whether dimension and sub-path terms should be indexed.Utility class with a single method for getting a DocIdSetIterator that skips deleted docsSingle label and its value, usually contained in aFacetResult.Facetsimplementation that computes counts for all unique long values, more efficiently counting small values (0-1023) using an int array, and switching to aHashMapfor values above 1023.Per-segment, per-document double values, which can be calculated at search-time.Base class for producingMultiDoubleValues.A multi-termsQueryover aFacetField.Maps specified dims to provided Facets impls; else, uses the default Facets impl.Per-segment, per-document long values, which can be calculated at search-time.Base class for producingMultiLongValues.Collects hits for subsequent faceting, using sampling if needed.Compute facet counts from a previously indexedSortedSetDocValuesorSortedDocValuesfield.Keeps highest results, first by largest float value, then tie-break by smallest ord.Holds an ordinal and a float value.Keeps highest results, first by largest int value, then tie-break by smallest ord.Holds an ordinal and an int value.Keeps highest results, first by largest value, then tie-break by smallest ord.Holds a single entry.