VectorColumn (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.document.column, class: VectorColumn

Package org.apache.lucene.document.column

# Class VectorColumn<T>

java.lang.Object
org.apache.lucene.document.column.Column
org.apache.lucene.document.column.VectorColumn<T>

Type Parameters:
  `T` - the vector array type, either `float[]` or `byte[]`

public abstract class VectorColumn<T> extends Column
A `Column` that provides KNN vector values via a tuple cursor. Vector columns are vector-only: the field type must declare `vectorDimension() > 0`, and must not also set doc values, points, stored, or `indexOptions`. Vectors are single-valued, so the cursor yields strictly increasing batch-local doc-ids.

The type parameter `T` must match `IndexableFieldType.vectorEncoding()`: `float[]` for `FLOAT32` and `byte[]` for `BYTE`. A mismatch is reported as a `ClassCastException` when values are consumed during indexing.

`DENSE` indicates that every batch-local doc has a vector; `SPARSE` allows gaps. Both densities use the same tuple cursor — there is no dense bulk-fill fast path for vectors.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.document.column.Column

  `Column.Density`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `VectorColumn(String name, IndexableFieldType fieldType, Column.Density density)`
  Creates a VectorColumn with the given field name, type, and density.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract ObjectTupleCursor<T>`
  `tuples()`
  Returns a fresh tuple cursor starting at the beginning of the batch.

  ### Methods inherited from class org.apache.lucene.document.column.Column

  `density, fieldType, name`

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

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

- ## Constructor Details

  - ### VectorColumn

    protected VectorColumn(String name, IndexableFieldType fieldType, Column.Density density)
    Creates a VectorColumn with the given field name, type, and density.
    Throws:
      `IllegalArgumentException` - if `fieldType.vectorDimension() <= 0`

- ## Method Details

  - ### tuples

    public abstract ObjectTupleCursor<T> tuples()
    Returns a fresh tuple cursor starting at the beginning of the batch.