KnnFieldVectorsWriter (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.codecs, class: KnnFieldVectorsWriter

Package org.apache.lucene.codecs

# Class KnnFieldVectorsWriter<T>

java.lang.Object
org.apache.lucene.codecs.KnnFieldVectorsWriter<T>

Type Parameters:
  `T` - an array type; the type of vectors to be written

All Implemented Interfaces:
  `Accountable`

Direct Known Subclasses:
  `FlatFieldVectorsWriter`

public abstract class KnnFieldVectorsWriter<T> extends Object implements Accountable
Vectors writer for a field.

- ## Field Summary

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `KnnFieldVectorsWriter()`
  Sole constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract void`
  `addValue(int docID, T vectorValue)`
  Add new docID with its vector value to the given field for indexing.
  `abstract T`
  `copyValue(T vectorValue)`
  Used to copy values being indexed to internal storage.

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

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

  ### Methods inherited from interface org.apache.lucene.util.Accountable

  `getChildResources, ramBytesUsed`

- ## Constructor Details

  - ### KnnFieldVectorsWriter

    protected KnnFieldVectorsWriter()
    Sole constructor

- ## Method Details

  - ### addValue

    public abstract void addValue(int docID, T vectorValue) throws IOException
    Add new docID with its vector value to the given field for indexing. Doc IDs must be added in increasing order.
    Throws:
      `IOException`

  - ### copyValue

    public abstract T copyValue(T vectorValue)
    Used to copy values being indexed to internal storage.
    Parameters:
      `vectorValue` - an array containing the vector value to add
    Returns:
      a copy of the value; a new array