Class HnswBitVectorsFormat
- java.lang.Object
-
- org.apache.lucene.codecs.KnnVectorsFormat
-
- org.apache.lucene.codecs.bitvectors.HnswBitVectorsFormat
-
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
public final class HnswBitVectorsFormat extends KnnVectorsFormat
Encodes bit vector values into an associated graph connecting the documents having values. The graph is used to power HNSW search. The format consists of two files, and usesLucene99FlatVectorsFormatto store the actual vectors, but with a custom scorer implementation: For details on graph storage and file extensions, seeLucene99HnswVectorsFormat.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAME-
Fields inherited from class org.apache.lucene.codecs.KnnVectorsFormat
DEFAULT_MAX_DIMENSIONS, EMPTY
-
-
Constructor Summary
Constructors Constructor Description HnswBitVectorsFormat()Constructs a format using default graph construction parametersHnswBitVectorsFormat(int maxConn, int beamWidth)Constructs a format using the given graph construction parameters.HnswBitVectorsFormat(int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)Constructs a format using the given graph construction parameters and scalar quantization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KnnVectorsReaderfieldsReader(SegmentReadState state)KnnVectorsWriterfieldsWriter(SegmentWriteState state)intgetMaxDimensions(String fieldName)StringtoString()-
Methods inherited from class org.apache.lucene.codecs.KnnVectorsFormat
availableKnnVectorsFormats, forName, getName, reloadKnnVectorsFormat
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HnswBitVectorsFormat
public HnswBitVectorsFormat()
Constructs a format using default graph construction parameters
-
HnswBitVectorsFormat
public HnswBitVectorsFormat(int maxConn, int beamWidth)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.
-
HnswBitVectorsFormat
public HnswBitVectorsFormat(int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec)Constructs a format using the given graph construction parameters and scalar quantization.- Parameters:
maxConn- the maximum number of connections to a node in the HNSW graphbeamWidth- the size of the queue maintained during graph construction.numMergeWorkers- number of workers (threads) that will be used when doing merge. If larger than 1, a non-nullExecutorServicemust be passed as mergeExecmergeExec- theExecutorServicethat will be used by ALL vector writers that are generated by this format to do the merge
-
-
Method Detail
-
fieldsWriter
public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException
- Specified by:
fieldsWriterin classKnnVectorsFormat- Throws:
IOException
-
fieldsReader
public KnnVectorsReader fieldsReader(SegmentReadState state) throws IOException
- Specified by:
fieldsReaderin classKnnVectorsFormat- Throws:
IOException
-
getMaxDimensions
public int getMaxDimensions(String fieldName)
- Overrides:
getMaxDimensionsin classKnnVectorsFormat
-
-