Package org.apache.lucene.codecs
Class KnnVectorsFormat
java.lang.Object
org.apache.lucene.codecs.KnnVectorsFormat
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
- Direct Known Subclasses:
Lucene99HnswScalarQuantizedVectorsFormat
,Lucene99HnswVectorsFormat
,PerFieldKnnVectorsFormat
Encodes/decodes per-document vector and any associated indexing structures required to support
nearest-neighbor search
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum number of vector dimensionsstatic final KnnVectorsFormat
EMPTY throws an exception when written. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract KnnVectorsReader
fieldsReader
(SegmentReadState state) Returns aKnnVectorsReader
to read the vectors from the index.abstract KnnVectorsWriter
fieldsWriter
(SegmentWriteState state) Returns aKnnVectorsWriter
to write the vectors to the index.static KnnVectorsFormat
looks up a format by nameint
getMaxDimensions
(String fieldName) Returns the maximum number of vector dimensions supported by this codec for the given field namegetName()
-
Field Details
-
DEFAULT_MAX_DIMENSIONS
public static final int DEFAULT_MAX_DIMENSIONSThe maximum number of vector dimensions- See Also:
-
EMPTY
EMPTY throws an exception when written. It acts as a sentinel indicating a Codec that does not support vectors.
-
-
Constructor Details
-
KnnVectorsFormat
Sole constructor
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceNamedSPILoader.NamedSPI
-
forName
looks up a format by name -
fieldsWriter
Returns aKnnVectorsWriter
to write the vectors to the index.- Throws:
IOException
-
fieldsReader
Returns aKnnVectorsReader
to read the vectors from the index.- Throws:
IOException
-
getMaxDimensions
Returns the maximum number of vector dimensions supported by this codec for the given field nameCodecs should override this method to specify the maximum number of dimensions they support.
- Parameters:
fieldName
- the field name- Returns:
- the maximum number of vector dimensions.
-