Package org.apache.lucene.index

## Class ByteVectorValues

- java.lang.Object
- - org.apache.lucene.search.DocIdSetIterator
  - - org.apache.lucene.index.ByteVectorValues

- Direct Known Subclasses:
    `OffHeapByteVectorValues`

      public abstract class ByteVectorValues
      extends DocIdSetIterator

  This class provides access to per-document floating point vector values indexed as `KnnByteVectorField`.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.DocIdSetIterator

      `NO_MORE_DOCS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `ByteVectorValues()` | Sole constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `checkField​(LeafReader in, String field)` | Checks the Vector Encoding of a field
    `long` | `cost()` | Returns the estimated cost of this `DocIdSetIterator`.
    `abstract int` | `dimension()` | Return the dimension of the vectors
    `abstract VectorScorer` | `scorer​(byte[] query)` | Return a `VectorScorer` for the given query vector.
    `abstract int` | `size()` | Return the number of vectors for this field.
    `abstract byte[]` | `vectorValue()` | Return the vector value for the current document ID.

    - ### Methods inherited from class org.apache.lucene.search.DocIdSetIterator

      `advance, all, docID, empty, nextDoc, range, slowAdvance`

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

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

- - ### Constructor Detail

    - #### ByteVectorValues

          protected ByteVectorValues()

      Sole constructor

  - ### Method Detail

    - #### dimension

          public abstract int dimension()

      Return the dimension of the vectors

    - #### size

          public abstract int size()

      Return the number of vectors for this field.
      Returns:
        the number of vectors returned by this iterator

    - #### cost

          public final long cost()

      Description copied from class: `DocIdSetIterator`
      Returns the estimated cost of this `DocIdSetIterator`.

      This is generally an upper bound of the number of documents this iterator might match, but may be a rough heuristic, hardcoded value, or otherwise completely inaccurate.

      Specified by:
        `cost` in class `DocIdSetIterator`

    - #### vectorValue

          public abstract byte[] vectorValue()
                                      throws IOException

      Return the vector value for the current document ID. It is illegal to call this method when the iterator is not positioned: before advancing, or after failing to advance. The returned array may be shared across calls, re-used, and modified as the iterator advances.
      Returns:
        the vector value
      Throws:
        `IOException`

    - #### checkField

          public static void checkField​(LeafReader in,
                                        String field)

      Checks the Vector Encoding of a field
      Throws:
        `IllegalStateException` - if `field` has vectors, but using a different encoding
      WARNING: This API is experimental and might change in incompatible ways in the next release.
      NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

    - #### scorer

          public abstract VectorScorer scorer​(byte[] query)
                                       throws IOException

      Return a `VectorScorer` for the given query vector. The iterator for the scorer is not the same instance as the iterator for this `ByteVectorValues`. It is a copy, and iteration over the scorer will not affect the iteration of this `ByteVectorValues`.
      Parameters:
        `query` - the query vector
      Returns:
        a `VectorScorer` instance or null
      Throws:
        `IOException`