Class FlatFieldVectorsWriter<T>

java.lang.Object
org.apache.lucene.codecs.KnnFieldVectorsWriter<T>
org.apache.lucene.codecs.hnsw.FlatFieldVectorsWriter<T>
Type Parameters:
T - an array type; the type of vectors to be written
All Implemented Interfaces:
Accountable

public abstract class FlatFieldVectorsWriter<T> extends KnnFieldVectorsWriter<T>
Vectors' writer for a field
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Constructor Details

    • FlatFieldVectorsWriter

      public FlatFieldVectorsWriter()
  • Method Details

    • getVectors

      public abstract List<T> getVectors()
      Returns:
      a list of vectors to be written
    • asKnnVectorValues

      public KnnVectorValues asKnnVectorValues(VectorEncoding encoding, int dim) throws IOException
      Returns a KnnVectorValues view over the vectors to be written.

      This default implementation uses getVectors() and wraps them via FloatVectorValues.fromFloats(java.util.List<float[]>, int) / ByteVectorValues.fromBytes(java.util.List<byte[]>, int). Subclasses backed by alternative storage may override to return a richer view (e.g. one that exposes capability information to scorers, or avoids heap materialization).

      Parameters:
      encoding - the vector encoding/element type
      dim - the field's declared vector dimension
      Throws:
      IOException
    • getDocsWithFieldSet

      public abstract DocsWithFieldSet getDocsWithFieldSet()
      Returns:
      the docsWithFieldSet for the field writer
    • finish

      public abstract void finish() throws IOException
      indicates that this writer is done and no new vectors are allowed to be added
      Throws:
      IOException - if an I/O error occurs
    • isFinished

      public abstract boolean isFinished()
      Returns:
      true if the writer is done and no new vectors are allowed to be added