org.apache.lucene.facet.package.html Maven / Gradle / Ivy
Show all versions of aem-sdk-api Show documentation
faceted search
faceted search
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
(({@link org.apache.lucene.facet.taxonomy.FastTaxonomyFacetCounts}, {@link
org.apache.lucene.facet.taxonomy.TaxonomyFacetCounts}) aggregate long or double values {@link
org.apache.lucene.facet.taxonomy.TaxonomyFacetSumIntAssociations}, {@link
org.apache.lucene.facet.taxonomy.TaxonomyFacetSumFloatAssociations}, {@link
org.apache.lucene.facet.taxonomy.TaxonomyFacetSumValueSource}. Add {@link org.apache.lucene.facet.FacetField} or
{@link org.apache.lucene.facet.taxonomy.AssociationFacetField} to 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 ({@link org.apache.lucene.facet.sortedset.SortedSetDocValuesFacetCounts}). Add
{@link org.apache.lucene.facet.sortedset.SortedSetDocValuesFacetField} to your documents at
index time to use sorted set facet counts.
- Range faceting {@link org.apache.lucene.facet.range.LongRangeFacetCounts}, {@link
org.apache.lucene.facet.range.DoubleRangeFacetCounts} compute counts for a dynamic numeric
range from a provided {@link org.apache.lucene.queries.function.ValueSource} (previously indexed
numeric field, or a dynamic expression such as distance).
At search time you first run your search, but pass a {@link
org.apache.lucene.facet.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
{@link org.apache.lucene.facet.Facets} base API that you use to obtain specific facet
counts.
The various {@link org.apache.lucene.facet.FacetsCollector#search} utility methods are
useful for doing an "ordinary" search (sorting by score, or by a
specified Sort) but also collecting into a {@link org.apache.lucene.facet.FacetsCollector} for
subsequent faceting.