Class HnswVectorsFormat
- java.lang.Object
-
- org.apache.lucene.codecs.KnnVectorsFormat
-
- org.apache.pinot.segment.local.segment.creator.impl.vector.lucene95.HnswVectorsFormat
-
- All Implemented Interfaces:
org.apache.lucene.util.NamedSPILoader.NamedSPI
public final class HnswVectorsFormat extends org.apache.lucene.codecs.KnnVectorsFormatExtend Lucene 9.5 vector format to support HNSW graph The major change here is to allow higher dimension vectors
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_DIMENSIONSThe maximum number of dimensions supported by this format.
-
Constructor Summary
Constructors Constructor Description HnswVectorsFormat(int maxConn, int beamWidth, int maxDimensions)Constructs a format using the given graph construction parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.codecs.KnnVectorsReaderfieldsReader(org.apache.lucene.index.SegmentReadState state)org.apache.lucene.codecs.KnnVectorsWriterfieldsWriter(org.apache.lucene.index.SegmentWriteState state)intgetMaxDimensions(String fieldName)StringtoString()
-
-
-
Field Detail
-
DEFAULT_MAX_DIMENSIONS
public static final int DEFAULT_MAX_DIMENSIONS
The maximum number of dimensions supported by this format. This is a limitation of the underlying implementation ofHnswGraphwhich uses a fixed size array to store the vector values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HnswVectorsFormat
public HnswVectorsFormat(int maxConn, int beamWidth, int maxDimensions)Constructs a format using the given graph construction parameters.- Parameters:
maxConn- the maximum number of connections to a node in the HNSW graphbeamWidth- the size of the queue maintained during graph construction.maxDimensions- the maximum number of dimensions supported by this format
-
-
Method Detail
-
fieldsWriter
public org.apache.lucene.codecs.KnnVectorsWriter fieldsWriter(org.apache.lucene.index.SegmentWriteState state) throws IOException- Specified by:
fieldsWriterin classorg.apache.lucene.codecs.KnnVectorsFormat- Throws:
IOException
-
fieldsReader
public org.apache.lucene.codecs.KnnVectorsReader fieldsReader(org.apache.lucene.index.SegmentReadState state) throws IOException- Specified by:
fieldsReaderin classorg.apache.lucene.codecs.KnnVectorsFormat- Throws:
IOException
-
getMaxDimensions
public int getMaxDimensions(String fieldName)
- Overrides:
getMaxDimensionsin classorg.apache.lucene.codecs.KnnVectorsFormat
-
-