# Package org.apache.lucene.facet.taxonomy

package org.apache.lucene.facet.taxonomy
Taxonomy of Categories.

Facets are defined using a hierarchy of categories, known as a Taxonomy. For example, the taxonomy of a book store application might have the following structure:

- Author
  - Mark Twain
  - J. K. Rowling

- Date
  - 2010
  - March
  - April
- 2009

The Taxonomy translates category-paths into integer identifiers (often termed ordinals) and vice versa. The category `Author/Mark Twain` adds two nodes to the taxonomy: `Author` and `Author/Mark Twain`, each is assigned a different ordinal. The taxonomy maintains the invariant that a node always has an ordinal that is < all its children.

- Related Packages
  Package
  Description
  org.apache.lucene.facet
  Faceted search.
  org.apache.lucene.facet.taxonomy.directory
  Taxonomy index implementation using on top of a Directory.
  org.apache.lucene.facet.taxonomy.writercache
  Improves indexing time by caching a map of CategoryPath to their Ordinal.
  org.apache.lucene.facet.facetset
  Provides FacetSets faceting capabilities which allows users to facet on high dimensional field values.
  org.apache.lucene.facet.range
  Provides range faceting capabilities.
  org.apache.lucene.facet.rangeonrange
  Provides range on range faceting capabilities.
  org.apache.lucene.facet.sortedset
  Provides faceting capabilities over facets that were indexed with `SortedSetDocValuesFacetField`.
- Class
  Description
  AssociationAggregationFunction
  Specify aggregation logic used in `TaxonomyFacetIntAssociations` and `TaxonomyFacetFloatAssociations`.
  AssociationFacetField
  Add an instance of this to your `Document` to add a facet label associated with an arbitrary byte[].
  FacetLabel
  Holds a sequence of string components, specifying the hierarchical name of a category.
  FastTaxonomyFacetCounts
  Computes facets counts, assuming the default encoding into DocValues was used.
  FloatAssociationFacetField
  Add an instance of this to your `Document` to add a facet label associated with a float.
  IntAssociationFacetField
  Add an instance of this to your `Document` to add a facet label associated with an int.
  LRUHashMap<K,V>
  LRUHashMap is an extension of Java's HashMap, which has a bounded size(); When it reaches that size, each time a new element is added, the least recently used (LRU) entry is removed.
  OrdinalMappingLeafReader
  A `FilterLeafReader` for updating facets ordinal references, based on an ordinal map.
  ParallelTaxonomyArrays
  Returns 3 arrays for traversing the taxonomy: `parents`: `parents[i]` denotes the parent of category ordinal `i`.
  ParallelTaxonomyArrays.IntArray
  Abstraction that looks like an int[], but read-only.
  PrintTaxonomyStats
  Prints how many ords are under each dimension.
  SearcherTaxonomyManager
  Manages near-real-time reopen of both an IndexSearcher and a TaxonomyReader.
  SearcherTaxonomyManager.SearcherAndTaxonomy
  Holds a matched pair of `IndexSearcher` and `TaxonomyReader`
  TaxonomyFacetFloatAssociations
  Aggregates float values associated with facet fields.
  TaxonomyFacetIntAssociations
  Aggregates int values previously indexed with `IntAssociationFacetField`, assuming the default encoding.
  TaxonomyFacetLabels
  Utility class to easily retrieve previously indexed facet labels, allowing you to skip also adding stored fields for these values, reducing your index size.
  TaxonomyMergeUtils
  Utility methods for merging index and taxonomy directories.
  TaxonomyReader
  TaxonomyReader is the read-only interface with which the faceted-search library uses the taxonomy during search time.
  TaxonomyReader.ChildrenIterator
  An iterator over a category's children.
  TaxonomyWriter
  TaxonomyWriter is the interface which the faceted-search library uses to dynamically build the taxonomy at indexing time.