Module org.apache.lucene.facet
Package org.apache.lucene.facet.taxonomy
Class TaxonomyFacetLabels.FacetLabelReader
java.lang.Object
org.apache.lucene.facet.taxonomy.TaxonomyFacetLabels.FacetLabelReader
- Enclosing class:
TaxonomyFacetLabels
Utility class to retrieve facet labels for multiple documents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private int
private int
private int
private final SortedNumericDocValues
By default, we store taxonomy ordinals in SortedNumericDocValues fieldprivate ParallelTaxonomyArrays.IntArray
-
Constructor Summary
ConstructorsConstructorDescriptionFacetLabelReader
(SortedNumericDocValues ordinalValues) Construct from a specifiedSortedNumericDocValues
field. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
isDescendant
(int ord, int ancestorOrd) nextFacetLabel
(int docId) nextFacetLabel
(int docId, String facetDimension) Retrieves the nextFacetLabel
for the specifieddocId
under the requestedfacetDimension
, ornull
if there are no more.
-
Field Details
-
ordinalValues
By default, we store taxonomy ordinals in SortedNumericDocValues field -
currentDocId
private int currentDocId -
currentDocHasValues
private boolean currentDocHasValues -
currentPos
private int currentPos -
currentDocOrdinalCount
private int currentDocOrdinalCount -
parents
-
-
Constructor Details
-
FacetLabelReader
Construct from a specifiedSortedNumericDocValues
field.
-
-
Method Details
-
nextFacetLabel
Retrieves the nextFacetLabel
for the specifieddocId
, ornull
if there are no more. This method has state: if the provideddocId
is the same as the previous invocation, it returns the nextFacetLabel
for that document. Otherwise, it advances to the newdocId
and provides the firstFacetLabel
for that document, ornull
if that document has no indexed facets. Each newdocId
must be in strictly monotonic (increasing) order.NOTE: The returned FacetLabels may not be in the same order in which they were indexed
- Parameters:
docId
- input docId provided in monotonic (non-decreasing) order- Returns:
- the first or next
FacetLabel
, ornull
if there are no more - Throws:
IOException
- when a low-level IO issue occursIllegalArgumentException
- if docId provided is less than docId supplied in an earlier invocation
-
isDescendant
private boolean isDescendant(int ord, int ancestorOrd) -
nextFacetLabel
Retrieves the nextFacetLabel
for the specifieddocId
under the requestedfacetDimension
, ornull
if there are no more. This method has state: if the provideddocId
is the same as the previous invocation, it returns the nextFacetLabel
for that document. Otherwise, it advances to the newdocId
and provides the firstFacetLabel
for that document, ornull
if that document has no indexed facets. Each newdocId
must be in strictly monotonic (increasing) order.NOTE: This method loads the
int[] parents
array from the taxonomy index. The returned FacetLabels may not be in the same order in which they were indexed.- Parameters:
docId
- input docId provided in non-decreasing order- Returns:
- the first or next
FacetLabel
, ornull
if there are no more - Throws:
IOException
- ifTaxonomyReader
has problems getting path for an ordinalIllegalArgumentException
- if docId provided is less than docId supplied in an earlier invocationIllegalArgumentException
- if facetDimension is null
-