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 and Description
    --- | ---
    `static Bits` | `docsWithValue(SortedDocValues dv, int maxDoc)` Returns a Bits representing all documents from `dv` that have a value.
    `static Bits` | `docsWithValue(SortedNumericDocValues dv, int maxDoc)` Returns a Bits representing all documents from `dv` that have a value.
    `static Bits` | `docsWithValue(SortedSetDocValues dv, int maxDoc)` Returns a Bits representing all documents from `dv` that have a value.
    `static BinaryDocValues` | `emptyBinary()` An empty BinaryDocValues which returns `BytesRef.EMPTY_BYTES` for every document
    `static NumericDocValues` | `emptyNumeric()` An empty NumericDocValues which returns zero for every document
    `static SortedDocValues` | `emptySorted()` An empty SortedDocValues which returns `BytesRef.EMPTY_BYTES` for every document
    `static SortedNumericDocValues` | `emptySortedNumeric(int maxDoc)` An empty SortedNumericDocValues which returns zero values for every document
    `static RandomAccessOrds` | `emptySortedSet()` An empty SortedDocValues which returns `SortedSetDocValues.NO_MORE_ORDS` for every document
    `static BinaryDocValues` | `getBinary(LeafReader reader, String field)` Returns BinaryDocValues for the field, or `emptyBinary()` if it has none.
    `static Bits` | `getDocsWithField(LeafReader reader, String field)` Returns Bits for the field, or `Bits` matching nothing if it has none.
    `static NumericDocValues` | `getNumeric(LeafReader reader, String field)` Returns NumericDocValues for the field, or `emptyNumeric()` if it has none.
    `static SortedDocValues` | `getSorted(LeafReader reader, String field)` Returns SortedDocValues for the field, or `emptySorted()` if it has none.
    `static SortedNumericDocValues` | `getSortedNumeric(LeafReader reader, String field)` Returns SortedNumericDocValues for the field, or `emptySortedNumeric(int)` if it has none.
    `static SortedSetDocValues` | `getSortedSet(LeafReader reader, String field)` Returns SortedSetDocValues for the field, or `emptySortedSet()` if it has none.
    `static SortedNumericDocValues` | `singleton(NumericDocValues dv, Bits docsWithField)` Returns a multi-valued view over the provided NumericDocValues
    `static RandomAccessOrds` | `singleton(SortedDocValues dv)` Returns a multi-valued view over the provided SortedDocValues
    `static NumericDocValues` | `unwrapSingleton(SortedNumericDocValues dv)` Returns a single-valued view of the SortedNumericDocValues, if it was previously wrapped with `singleton(NumericDocValues, Bits)`, or null.
    `static SortedDocValues` | `unwrapSingleton(SortedSetDocValues dv)` Returns a single-valued view of the SortedSetDocValues, if it was previously wrapped with `singleton(SortedDocValues)`, or null.
    `static Bits` | `unwrapSingletonBits(SortedNumericDocValues dv)` Returns the documents with a value for the SortedNumericDocValues, if it was previously wrapped with `singleton(NumericDocValues, Bits)`, or null.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### emptyBinary

          public static final BinaryDocValues emptyBinary()

      An empty BinaryDocValues which returns `BytesRef.EMPTY_BYTES` for every document

    - #### emptyNumeric

          public static final NumericDocValues emptyNumeric()

      An empty NumericDocValues which returns zero for every document

    - #### emptySorted

          public static final SortedDocValues emptySorted()

      An empty SortedDocValues which returns `BytesRef.EMPTY_BYTES` for every document

    - #### emptySortedNumeric

          public static final SortedNumericDocValues emptySortedNumeric(int maxDoc)

      An empty SortedNumericDocValues which returns zero values for every document

    - #### emptySortedSet

          public static final RandomAccessOrds emptySortedSet()

      An empty SortedDocValues which returns `SortedSetDocValues.NO_MORE_ORDS` for every document

    - #### singleton

          public static RandomAccessOrds 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 with `singleton(SortedDocValues)`, or null.

    - #### unwrapSingleton

          public static NumericDocValues unwrapSingleton(SortedNumericDocValues dv)

      Returns a single-valued view of the SortedNumericDocValues, if it was previously wrapped with `singleton(NumericDocValues, Bits)`, or null.
      See Also:
        `unwrapSingletonBits(SortedNumericDocValues)`

    - #### unwrapSingletonBits

          public static Bits unwrapSingletonBits(SortedNumericDocValues dv)

      Returns the documents with a value for the SortedNumericDocValues, if it was previously wrapped with `singleton(NumericDocValues, Bits)`, or null.

    - #### singleton

          public static SortedNumericDocValues singleton(NumericDocValues dv,
                                                         Bits docsWithField)

      Returns a multi-valued view over the provided NumericDocValues

    - #### docsWithValue

          public static Bits docsWithValue(SortedDocValues dv,
                                           int maxDoc)

      Returns a Bits representing all documents from `dv` that have a value.

    - #### docsWithValue

          public static Bits docsWithValue(SortedSetDocValues dv,
                                           int maxDoc)

      Returns a Bits representing all documents from `dv` that have a value.

    - #### docsWithValue

          public static Bits docsWithValue(SortedNumericDocValues dv,
                                           int maxDoc)

      Returns a Bits representing all documents from `dv` that have a value.

    - #### getNumeric

          public static NumericDocValues getNumeric(LeafReader reader,
                                                    String field)
                                             throws IOException

      Returns NumericDocValues for the field, or `emptyNumeric()` if it has none.
      Returns:
        docvalues instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IllegalStateException` - if `field` has docvalues, but the type is not `DocValuesType.NUMERIC`.
        `IOException` - if an I/O error occurs.

    - #### getBinary

          public static BinaryDocValues getBinary(LeafReader reader,
                                                  String field)
                                           throws IOException

      Returns BinaryDocValues for the field, or `emptyBinary()` if it has none.
      Returns:
        docvalues instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IllegalStateException` - if `field` has docvalues, but the type is not `DocValuesType.BINARY` or `DocValuesType.SORTED`.
        `IOException` - if an I/O error occurs.

    - #### getSorted

          public static SortedDocValues getSorted(LeafReader reader,
                                                  String field)
                                           throws IOException

      Returns SortedDocValues for the field, or `emptySorted()` if it has none.
      Returns:
        docvalues instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IllegalStateException` - if `field` has docvalues, but the type is not `DocValuesType.SORTED`.
        `IOException` - if an I/O error occurs.

    - #### getSortedNumeric

          public static SortedNumericDocValues getSortedNumeric(LeafReader reader,
                                                                String field)
                                                         throws IOException

      Returns SortedNumericDocValues for the field, or `emptySortedNumeric(int)` if it has none.
      Returns:
        docvalues instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IllegalStateException` - if `field` has docvalues, but the type is not `DocValuesType.SORTED_NUMERIC` or `DocValuesType.NUMERIC`.
        `IOException` - if an I/O error occurs.

    - #### getSortedSet

          public static SortedSetDocValues getSortedSet(LeafReader reader,
                                                        String field)
                                                 throws IOException

      Returns SortedSetDocValues for the field, or `emptySortedSet()` if it has none.
      Returns:
        docvalues instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IllegalStateException` - if `field` has docvalues, but the type is not `DocValuesType.SORTED_SET` or `DocValuesType.SORTED`.
        `IOException` - if an I/O error occurs.

    - #### getDocsWithField

          public static Bits getDocsWithField(LeafReader reader,
                                              String field)
                                       throws IOException

      Returns Bits for the field, or `Bits` matching nothing if it has none.
      Returns:
        bits instance, or an empty instance if `field` does not exist in this reader.
      Throws:
        `IllegalStateException` - if `field` exists, but was not indexed with docvalues.
        `IOException` - if an I/O error occurs.

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.