Package org.apache.lucene.index
Class DocValues
java.lang.Object
org.apache.lucene.index.DocValues
This class contains utility methods and constants for DocValues
-
Method Summary
Modifier and TypeMethodDescriptionstatic final BinaryDocValuesAn emptyBinaryDocValueswhich returns no documentsstatic final NumericDocValuesAn empty NumericDocValues which returns no documentsstatic final SortedDocValuesAn empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every documentstatic final SortedNumericDocValuesAn empty SortedNumericDocValues which returns zero values for every documentstatic final SortedSetDocValuesAn empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every documentstatic BinaryDocValuesgetBinary(LeafReader reader, String field) Returns BinaryDocValues for the field, oremptyBinary()if it has none.static NumericDocValuesgetNumeric(LeafReader reader, String field) Returns NumericDocValues for the field, oremptyNumeric()if it has none.static SortedDocValuesgetSorted(LeafReader reader, String field) Returns SortedDocValues for the field, oremptySorted()if it has none.static SortedNumericDocValuesgetSortedNumeric(LeafReader reader, String field) Returns SortedNumericDocValues for the field, oremptySortedNumeric()if it has none.static SortedSetDocValuesgetSortedSet(LeafReader reader, String field) Returns SortedSetDocValues for the field, oremptySortedSet()if it has none.static booleanisCacheable(LeafReaderContext ctx, String... fields) Returnstrueif the specified docvalues fields have not been updatedstatic SortedNumericDocValuesReturns a multi-valued view over the provided NumericDocValuesstatic SortedSetDocValuesReturns a multi-valued view over the provided SortedDocValuesstatic NumericDocValuesReturns a single-valued view of the SortedNumericDocValues, if it was previously wrapped withsingleton(NumericDocValues), or null.static SortedDocValuesReturns a single-valued view of the SortedSetDocValues, if it was previously wrapped withsingleton(SortedDocValues), or null.
-
Method Details
-
emptyBinary
An emptyBinaryDocValueswhich returns no documents -
emptyNumeric
An empty NumericDocValues which returns no documents -
emptySorted
An empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every document -
emptySortedNumeric
An empty SortedNumericDocValues which returns zero values for every document -
emptySortedSet
An empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every document -
singleton
Returns a multi-valued view over the provided SortedDocValues -
unwrapSingleton
Returns a single-valued view of the SortedSetDocValues, if it was previously wrapped withsingleton(SortedDocValues), or null. -
unwrapSingleton
Returns a single-valued view of the SortedNumericDocValues, if it was previously wrapped withsingleton(NumericDocValues), or null. -
singleton
Returns a multi-valued view over the provided NumericDocValues -
getNumeric
Returns NumericDocValues for the field, oremptyNumeric()if it has none.- Returns:
- docvalues instance, or an empty instance if
fielddoes not exist in this reader. - Throws:
IllegalStateException- iffieldexists, but was not indexed with docvalues.IllegalStateException- iffieldhas docvalues, but the type is notDocValuesType.NUMERIC.IOException- if an I/O error occurs.
-
getBinary
Returns BinaryDocValues for the field, oremptyBinary()if it has none.- Returns:
- docvalues instance, or an empty instance if
fielddoes not exist in this reader. - Throws:
IllegalStateException- iffieldexists, but was not indexed with docvalues.IllegalStateException- iffieldhas docvalues, but the type is notDocValuesType.BINARY.IOException- if an I/O error occurs.
-
getSorted
Returns SortedDocValues for the field, oremptySorted()if it has none.- Returns:
- docvalues instance, or an empty instance if
fielddoes not exist in this reader. - Throws:
IllegalStateException- iffieldexists, but was not indexed with docvalues.IllegalStateException- iffieldhas docvalues, but the type is notDocValuesType.SORTED.IOException- if an I/O error occurs.
-
getSortedNumeric
public static SortedNumericDocValues getSortedNumeric(LeafReader reader, String field) throws IOException Returns SortedNumericDocValues for the field, oremptySortedNumeric()if it has none.- Returns:
- docvalues instance, or an empty instance if
fielddoes not exist in this reader. - Throws:
IllegalStateException- iffieldexists, but was not indexed with docvalues.IllegalStateException- iffieldhas docvalues, but the type is notDocValuesType.SORTED_NUMERICorDocValuesType.NUMERIC.IOException- if an I/O error occurs.
-
getSortedSet
Returns SortedSetDocValues for the field, oremptySortedSet()if it has none.- Returns:
- docvalues instance, or an empty instance if
fielddoes not exist in this reader. - Throws:
IllegalStateException- iffieldexists, but was not indexed with docvalues.IllegalStateException- iffieldhas docvalues, but the type is notDocValuesType.SORTED_SETorDocValuesType.SORTED.IOException- if an I/O error occurs.
-
isCacheable
Returnstrueif the specified docvalues fields have not been updated
-