Package org.apache.lucene.index
Class DocValues
- java.lang.Object
-
- org.apache.lucene.index.DocValues
-
public final class DocValues extends Object
This class contains utility methods and constants for DocValues
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BinaryDocValuesemptyBinary()An emptyBinaryDocValueswhich returns no documentsstatic NumericDocValuesemptyNumeric()An empty NumericDocValues which returns no documentsstatic SortedDocValuesemptySorted()An empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every documentstatic SortedNumericDocValuesemptySortedNumeric()An empty SortedNumericDocValues which returns zero values for every documentstatic SortedSetDocValuesemptySortedSet()An 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 SortedNumericDocValuessingleton(NumericDocValues dv)Returns a multi-valued view over the provided NumericDocValuesstatic SortedSetDocValuessingleton(SortedDocValues dv)Returns a multi-valued view over the provided SortedDocValuesstatic NumericDocValuesunwrapSingleton(SortedNumericDocValues dv)Returns a single-valued view of the SortedNumericDocValues, if it was previously wrapped withsingleton(NumericDocValues), or null.static SortedDocValuesunwrapSingleton(SortedSetDocValues dv)Returns a single-valued view of the SortedSetDocValues, if it was previously wrapped withsingleton(SortedDocValues), or null.
-
-
-
Method Detail
-
emptyBinary
public static final BinaryDocValues emptyBinary()
An emptyBinaryDocValueswhich returns no documents
-
emptyNumeric
public static final NumericDocValues emptyNumeric()
An empty NumericDocValues which returns no documents
-
emptySorted
public static final SortedDocValues emptySorted()
An empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every document
-
emptySortedNumeric
public static final SortedNumericDocValues emptySortedNumeric()
An empty SortedNumericDocValues which returns zero values for every document
-
emptySortedSet
public static final SortedSetDocValues emptySortedSet()
An empty SortedDocValues which returnsBytesRef.EMPTY_BYTESfor every document
-
singleton
public static SortedSetDocValues singleton(SortedDocValues dv)
Returns a multi-valued view over the provided SortedDocValues
-
unwrapSingleton
public static SortedDocValues unwrapSingleton(SortedSetDocValues dv)
Returns a single-valued view of the SortedSetDocValues, if it was previously wrapped withsingleton(SortedDocValues), or null.
-
unwrapSingleton
public static NumericDocValues unwrapSingleton(SortedNumericDocValues dv)
Returns a single-valued view of the SortedNumericDocValues, if it was previously wrapped withsingleton(NumericDocValues), or null.
-
singleton
public static SortedNumericDocValues singleton(NumericDocValues dv)
Returns a multi-valued view over the provided NumericDocValues
-
getNumeric
public static NumericDocValues getNumeric(LeafReader reader, String field) throws IOException
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
public static BinaryDocValues getBinary(LeafReader reader, String field) throws IOException
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
public static SortedDocValues getSorted(LeafReader reader, String field) throws IOException
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
public static SortedSetDocValues getSortedSet(LeafReader reader, String field) throws IOException
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
public static boolean isCacheable(LeafReaderContext ctx, String... fields)
Returnstrueif the specified docvalues fields have not been updated
-
-