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

Package org.apache.lucene.codecs.hnsw

# Class FlatVectorsFormat

java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
org.apache.lucene.codecs.hnsw.FlatVectorsFormat

All Implemented Interfaces:
  `NamedSPILoader.NamedSPI`

Direct Known Subclasses:
  `Lucene104ScalarQuantizedVectorsFormat`, `Lucene99FlatVectorsFormat`

public abstract class FlatVectorsFormat extends KnnVectorsFormat
Encodes/decodes per-document vectors and provides a scoring interface for the flat stored vectors

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

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.codecs.KnnVectorsFormat

  `DEFAULT_MAX_DIMENSIONS, EMPTY`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `FlatVectorsFormat(String name)`
  Sole constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract FlatVectorsReader`
  `fieldsReader(SegmentReadState state)`
  Returns a `KnnVectorsReader` to read the vectors from the index.
  `abstract FlatVectorsWriter`
  `fieldsWriter(SegmentWriteState state)`
  Returns a `FlatVectorsWriter` to write the vectors to the index.
  `int`
  `getMaxDimensions(String fieldName)`
  Returns the maximum number of vector dimensions supported by this codec for the given field name

  ### Methods inherited from class org.apache.lucene.codecs.KnnVectorsFormat

  `availableKnnVectorsFormats, forName, getName, reloadKnnVectorsFormat`

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

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

- ## Constructor Details

  - ### FlatVectorsFormat

    protected FlatVectorsFormat(String name)
    Sole constructor

- ## Method Details

  - ### fieldsWriter

    public abstract FlatVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException
    Returns a `FlatVectorsWriter` to write the vectors to the index.
    Specified by:
      `fieldsWriter` in class `KnnVectorsFormat`
    Throws:
      `IOException`

  - ### fieldsReader

    public abstract FlatVectorsReader fieldsReader(SegmentReadState state) throws IOException
    Returns a `KnnVectorsReader` to read the vectors from the index.
    Specified by:
      `fieldsReader` in class `KnnVectorsFormat`
    Throws:
      `IOException`

  - ### getMaxDimensions

    public int getMaxDimensions(String fieldName)
    Description copied from class: `KnnVectorsFormat`
    Returns the maximum number of vector dimensions supported by this codec for the given field name

    Codecs implement this method to specify the maximum number of dimensions they support.

    Specified by:
      `getMaxDimensions` in class `KnnVectorsFormat`
    Parameters:
      `fieldName` - the field name
    Returns:
      the maximum number of vector dimensions.