Package org.apache.lucene.util.hnsw

## Interface RandomAccessVectorValues<T>

- All Known Subinterfaces:
    `RandomAccessQuantizedByteVectorValues`
  All Known Implementing Classes:
    `OffHeapByteVectorValues`, `OffHeapByteVectorValues.DenseOffHeapVectorValues`, `OffHeapFloatVectorValues`, `OffHeapFloatVectorValues.DenseOffHeapVectorValues`, `OffHeapQuantizedByteVectorValues`, `OffHeapQuantizedByteVectorValues.DenseOffHeapVectorValues`

      public interface RandomAccessVectorValues<T>

  Provides random access to vectors by dense ordinal. This interface is used by HNSW-based implementations of KNN search.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `RandomAccessVectorValues<T>` | `copy()` | Creates a new copy of this `RandomAccessVectorValues`.
    `int` | `dimension()` | Return the dimension of the returned vector values
    `default Bits` | `getAcceptOrds​(Bits acceptDocs)` | Returns the `Bits` representing live documents.
    `default int` | `ordToDoc​(int ord)` | Translates vector ordinal to the correct document ID.
    `int` | `size()` | Return the number of vector values
    `T` | `vectorValue​(int targetOrd)` | Return the vector value indexed at the given ordinal.

- - ### Method Detail

    - #### size

          int size()

      Return the number of vector values

    - #### dimension

          int dimension()

      Return the dimension of the returned vector values

    - #### vectorValue

          T vectorValue​(int targetOrd)
                 throws IOException

      Return the vector value indexed at the given ordinal.
      Parameters:
        `targetOrd` - a valid ordinal, ≥ 0 and < `size()`.
      Throws:
        `IOException`

    - #### copy

          RandomAccessVectorValues<T> copy()
                                    throws IOException

      Creates a new copy of this `RandomAccessVectorValues`. This is helpful when you need to access different values at once, to avoid overwriting the underlying float vector returned by `vectorValue(int)`.
      Throws:
        `IOException`

    - #### ordToDoc

          default int ordToDoc​(int ord)

      Translates vector ordinal to the correct document ID. By default, this is an identity function.
      Parameters:
        `ord` - the vector ordinal
      Returns:
        the document Id for that vector ordinal

    - #### getAcceptOrds

          default Bits getAcceptOrds​(Bits acceptDocs)

      Returns the `Bits` representing live documents. By default, this is an identity function.
      Parameters:
        `acceptDocs` - the accept docs
      Returns:
        the accept docs