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
- 2010
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.-
ClassDescriptionAdd an instance of this to your
Documentto add a facet label associated with an arbitrary byte[].A per-segment cache of documents' facet ordinals.Holds the cached ordinals in two paralelint[]arrays.Holds a sequence of string components, specifying the hierarchical name of a category.Decodes ordinals previously indexed into a BinaryDocValues fieldHolds a sequence of string components, specifying the hierarchical name of a category.Computes facets counts, assuming the default encoding into DocValues was used.Add an instance of this to yourDocumentto add a facet label associated with a float.Base class for all taxonomy-based facets that aggregate to a per-ords float[].Add an instance of this to yourDocumentto add a facet label associated with an int.Base class for all taxonomy-based facets that aggregate to a per-ords 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.Provides per-document ordinals.Returns ordinals for documents in one segment.Returns 3 arrays for traversing the taxonomy:parents:parents[i]denotes the parent of category ordinali.children:children[i]denotes a child of category ordinali.siblings:siblings[i]denotes the sibling of category ordinali. To traverse the taxonomy tree, you typically start withchildren[0](ordinal 0 is reserved for ROOT), and then depends if you want to do DFS or BFS, you callchildren[children[0]]orsiblings[children[0]]and so forth, respectively.Prints how many ords are under each dimension.Manages near-real-time reopen of both an IndexSearcher and a TaxonomyReader.Holds a matched pair ofIndexSearcherandTaxonomyReaderReads from anyOrdinalsReader; useFastTaxonomyFacetCountsif you are using the default encoding fromBinaryDocValues.Base class for all taxonomy-based facets impls.Aggregates sum of int values previously indexed withFloatAssociationFacetField, assuming the default encoding.Aggregates sum of int values previously indexed withIntAssociationFacetField, assuming the default encoding.Aggregates sum of values fromFunctionValues.doubleVal(int), for each facet label.ValueSourcethat returns the score for each hit; use this to aggregate the sum of all hit scores for each facet label.TaxonomyReader is the read-only interface with which the faceted-search library uses the taxonomy during search time.An iterator over a category's children.TaxonomyWriter is the interface which the faceted-search library uses to dynamically build the taxonomy at indexing time.