Package org.apache.lucene.facet.taxonomy
Class TaxonomyFacets
- java.lang.Object
-
- org.apache.lucene.facet.Facets
-
- org.apache.lucene.facet.taxonomy.TaxonomyFacets
-
- Direct Known Subclasses:
FloatTaxonomyFacets,IntTaxonomyFacets
public abstract class TaxonomyFacets extends Facets
Base class for all taxonomy-based facets impls.
-
-
Field Summary
Fields Modifier and Type Field Description protected FacetsConfigconfigFacetsConfigprovided to the constructor.protected StringindexFieldNameIndex field name provided to the constructor.protected int[]parentsMaps an ordinal to its parent, or -1 if there is no parent (root node).protected TaxonomyReadertaxoReaderTaxonomyReaderprovided to the constructor.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTaxonomyFacets(String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config)Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanchildrenLoaded()Returns true if the (costly, and lazily initialized) children int[] was initialized.List<FacetResult>getAllDims(int topN)Returns topN labels for any dimension that had hits, sorted by the number of hits that dimension matched; this is used for "sparse" faceting, where many different dimensions were indexed, for example depending on the type of document.protected int[]getChildren()Returns int[] mapping each ordinal to its first child; this is a large array and is computed (and then saved) the first time this method is invoked.protected int[]getSiblings()Returns int[] mapping each ordinal to its next sibling; this is a large array and is computed (and then saved) the first time this method is invoked.booleansiblingsLoaded()Returns true if the (costly, and lazily initialized) sibling int[] was initialized.protected FacetsConfig.DimConfigverifyDim(String dim)ThrowsIllegalArgumentExceptionif the dimension is not recognized.-
Methods inherited from class org.apache.lucene.facet.Facets
getSpecificValue, getTopChildren
-
-
-
-
Field Detail
-
indexFieldName
protected final String indexFieldName
Index field name provided to the constructor.
-
taxoReader
protected final TaxonomyReader taxoReader
TaxonomyReaderprovided to the constructor.
-
config
protected final FacetsConfig config
FacetsConfigprovided to the constructor.
-
parents
protected final int[] parents
Maps an ordinal to its parent, or -1 if there is no parent (root node).
-
-
Constructor Detail
-
TaxonomyFacets
protected TaxonomyFacets(String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config) throws IOException
Sole constructor.- Throws:
IOException
-
-
Method Detail
-
getChildren
protected int[] getChildren() throws IOExceptionReturns int[] mapping each ordinal to its first child; this is a large array and is computed (and then saved) the first time this method is invoked.- Throws:
IOException
-
getSiblings
protected int[] getSiblings() throws IOExceptionReturns int[] mapping each ordinal to its next sibling; this is a large array and is computed (and then saved) the first time this method is invoked.- Throws:
IOException
-
childrenLoaded
public boolean childrenLoaded()
Returns true if the (costly, and lazily initialized) children int[] was initialized.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
siblingsLoaded
public boolean siblingsLoaded()
Returns true if the (costly, and lazily initialized) sibling int[] was initialized.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
verifyDim
protected FacetsConfig.DimConfig verifyDim(String dim)
ThrowsIllegalArgumentExceptionif the dimension is not recognized. Otherwise, returns theFacetsConfig.DimConfigfor this dimension.
-
getAllDims
public List<FacetResult> getAllDims(int topN) throws IOException
Description copied from class:FacetsReturns topN labels for any dimension that had hits, sorted by the number of hits that dimension matched; this is used for "sparse" faceting, where many different dimensions were indexed, for example depending on the type of document.- Specified by:
getAllDimsin classFacets- Throws:
IOException
-
-