Module org.apache.lucene.facet
Class DefaultSortedSetDocValuesReaderState
java.lang.Object
org.apache.lucene.facet.sortedset.SortedSetDocValuesReaderState
org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState
- All Implemented Interfaces:
Accountable
Default implementation of
SortedSetDocValuesFacetCounts. You must ensure the original
IndexReader passed to the constructor is not closed whenever you use this class!-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classNested classes/interfaces inherited from class org.apache.lucene.facet.sortedset.SortedSetDocValuesReaderState
SortedSetDocValuesReaderState.DimTree, SortedSetDocValuesReaderState.OrdRange -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, OrdinalMap> There is only ever one cached ordinal map, but storing it in a hash map together with the field name is convenient.private final FacetsConfigprivate final Stringprivate final Map<String, SortedSetDocValuesReaderState.DimTree> Used for hierarchical dims.private final Map<String, SortedSetDocValuesReaderState.OrdRange> Used for flat dims.final IndexReaderIndexReaderpassed to the constructor.private final intFields inherited from class org.apache.lucene.facet.sortedset.SortedSetDocValuesReaderState
INVALID_ORDINALFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSortedSetDocValuesReaderState(IndexReader reader, String field, FacetsConfig config) Creates this, pulling doc values from the specified field.DefaultSortedSetDocValuesReaderState(IndexReader reader, FacetsConfig config) Creates this with a config, pulling doc values from the defaultFacetsConfig.DEFAULT_INDEX_FIELD_NAME. -
Method Summary
Modifier and TypeMethodDescriptionprivate intcreateOneFlatFacetDimState(SortedSetDocValues dv, int dimStartOrd) private intcreateOneHierarchicalFacetDimState(SortedSetDocValues dv, int dimStartOrd) Returns nested resources of this class.getDims()Returns a list of all dimensionsgetDimTree(String dim) Returns mapping from prefix toSortedSetDocValuesReaderState.DimTreeReturn top-level doc values.Returns the associated facet config.getField()Indexed field we are reading.getOrdRange(String dim) Returns theSortedSetDocValuesReaderState.OrdRangefor this dimension.Returns mapping from prefix toSortedSetDocValuesReaderState.OrdRange.Returns top-level index reader.intgetSize()Number of unique labels.longReturn the memory usage of this object in bytes.toString()
-
Field Details
-
field
-
valueCount
private final int valueCount -
reader
IndexReaderpassed to the constructor. -
cachedOrdMap
There is only ever one cached ordinal map, but storing it in a hash map together with the field name is convenient. It enables us to have code blocks synchronized on the ordinal map even when the ordinal map is null and it makes it easy to call toAccountables.namedAccountables(String, Map)ingetChildResources(). -
config
-
prefixToDimTree
Used for hierarchical dims. -
prefixToOrdRange
Used for flat dims.
-
-
Constructor Details
-
DefaultSortedSetDocValuesReaderState
public DefaultSortedSetDocValuesReaderState(IndexReader reader, FacetsConfig config) throws IOException Creates this with a config, pulling doc values from the defaultFacetsConfig.DEFAULT_INDEX_FIELD_NAME.- Throws:
IOException
-
DefaultSortedSetDocValuesReaderState
public DefaultSortedSetDocValuesReaderState(IndexReader reader, String field, FacetsConfig config) throws IOException Creates this, pulling doc values from the specified field.- Throws:
IOException
-
-
Method Details
-
createOneHierarchicalFacetDimState
private int createOneHierarchicalFacetDimState(SortedSetDocValues dv, int dimStartOrd) throws IOException - Throws:
IOException
-
createOneFlatFacetDimState
- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()Return the memory usage of this object in bytes. Negative values are illegal. -
getChildResources
Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- See Also:
-
toString
-
getDocValues
Return top-level doc values.- Specified by:
getDocValuesin classSortedSetDocValuesReaderState- Throws:
IOException
-
getField
Indexed field we are reading.- Specified by:
getFieldin classSortedSetDocValuesReaderState
-
getReader
Description copied from class:SortedSetDocValuesReaderStateReturns top-level index reader.- Specified by:
getReaderin classSortedSetDocValuesReaderState
-
getSize
public int getSize()Number of unique labels.- Specified by:
getSizein classSortedSetDocValuesReaderState
-
getFacetsConfig
Description copied from class:SortedSetDocValuesReaderStateReturns the associated facet config.- Specified by:
getFacetsConfigin classSortedSetDocValuesReaderState
-
getDims
Description copied from class:SortedSetDocValuesReaderStateReturns a list of all dimensions- Specified by:
getDimsin classSortedSetDocValuesReaderState
-
getPrefixToOrdRange
Description copied from class:SortedSetDocValuesReaderStateReturns mapping from prefix toSortedSetDocValuesReaderState.OrdRange.- Specified by:
getPrefixToOrdRangein classSortedSetDocValuesReaderState
-
getOrdRange
Description copied from class:SortedSetDocValuesReaderStateReturns theSortedSetDocValuesReaderState.OrdRangefor this dimension.- Specified by:
getOrdRangein classSortedSetDocValuesReaderState
-
getDimTree
Description copied from class:SortedSetDocValuesReaderStateReturns mapping from prefix toSortedSetDocValuesReaderState.DimTree- Specified by:
getDimTreein classSortedSetDocValuesReaderState
-