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

Package org.apache.lucene.codecs.lucene99

# Class Lucene99FlatVectorsFormat

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

All Implemented Interfaces:
  `NamedSPILoader.NamedSPI`

public final class Lucene99FlatVectorsFormat extends FlatVectorsFormat
Lucene 9.9 flat vector format, which encodes numeric vector values

## .vec (vector data) file

For each field:

- Vector data ordered by field, document ordinal, and vector dimension. When the vectorEncoding is BYTE, each sample is stored as a single byte. When it is FLOAT32, each sample is stored as an IEEE float in little-endian byte order.
- DocIds encoded by `IndexedDISI.writeBitSet(DocIdSetIterator, IndexOutput, byte)`, note that only in sparse case
- OrdToDoc was encoded by `DirectMonotonicWriter`, note that only in sparse case

## .vemf (vector metadata) file

For each field:

- [int32] field number
- [int32] vector similarity function ordinal
- [vlong] offset to this field's vectors in the .vec file
- [vlong] length of this field's vectors, in bytes
- [vint] dimension of this field's vectors
- [int] the number of documents having values for this field
- [int8] if equals to -2, empty - no vector values. If equals to -1, dense – all documents have values for a field. If equals to 0, sparse – some documents missing values.
- DocIds were encoded by `IndexedDISI.writeBitSet(DocIdSetIterator, IndexOutput, byte)`
- OrdToDoc was encoded by `DirectMonotonicWriter`, note that only in sparse case

NOTE: Arm Neoverse machines have a performance overhead in reading data that is not aligned to 64 bytes, so this format aligns the `.vec` file to that size. There may be a performance penalty in searching of float vectors that do not have a dimension of a multiple of 16 (equivalent to 64 bytes), because the alignment will not hold for all vectors in the file.

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `VERSION_CURRENT`
  `static final int`
  `VERSION_START`

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

  `DEFAULT_MAX_DIMENSIONS, EMPTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Lucene99FlatVectorsFormat(FlatVectorsScorer vectorsScorer)`
  Constructs a format

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FlatVectorsReader`
  `fieldsReader(SegmentReadState state)`
  Returns a `KnnVectorsReader` to read the vectors from the index.
  `FlatVectorsWriter`
  `fieldsWriter(SegmentWriteState state)`
  Returns a `FlatVectorsWriter` to write the vectors to the index.
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.codecs.hnsw.FlatVectorsFormat

  `getMaxDimensions`

  ### 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, wait, wait, wait`

- ## Field Details

  - ### VERSION_START

    public static final int VERSION_START
    See Also:
      - Constant Field Values

  - ### VERSION_CURRENT

    public static final int VERSION_CURRENT
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Lucene99FlatVectorsFormat

    public Lucene99FlatVectorsFormat(FlatVectorsScorer vectorsScorer)
    Constructs a format

- ## Method Details

  - ### fieldsWriter

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

  - ### fieldsReader

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

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`