Package org.apache.lucene.util.hnsw
Class HnswConcurrentMergeBuilder
java.lang.Object
org.apache.lucene.util.hnsw.HnswConcurrentMergeBuilder
- All Implemented Interfaces:
HnswBuilder
A graph builder that manages multiple workers, it only supports adding the whole graph all at
once. It will spawn a thread for each worker and the workers will pick the work in batches.
-
Constructor Summary
ConstructorsConstructorDescriptionHnswConcurrentMergeBuilder(TaskExecutor taskExecutor, int numWorker, RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, OnHeapHnswGraph hnsw, BitSet initializedNodes) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGraphNode(int node) Inserts a doc with vector value to the graphbuild(int maxOrd) Adds all nodes to the graph up to the providedmaxOrd.Once this method is called no further updates to the graph are accepted (addGraphNode will throw IllegalStateException).getGraph()voidsetInfoStream(InfoStream infoStream) Set info-stream to output debugging information
-
Constructor Details
-
HnswConcurrentMergeBuilder
public HnswConcurrentMergeBuilder(TaskExecutor taskExecutor, int numWorker, RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, OnHeapHnswGraph hnsw, BitSet initializedNodes) throws IOException - Throws:
IOException
-
-
Method Details
-
build
Description copied from interface:HnswBuilderAdds all nodes to the graph up to the providedmaxOrd.- Specified by:
buildin interfaceHnswBuilder- Parameters:
maxOrd- The maximum ordinal (excluded) of the nodes to be added.- Throws:
IOException
-
addGraphNode
Description copied from interface:HnswBuilderInserts a doc with vector value to the graph- Specified by:
addGraphNodein interfaceHnswBuilder- Throws:
IOException
-
setInfoStream
Description copied from interface:HnswBuilderSet info-stream to output debugging information- Specified by:
setInfoStreamin interfaceHnswBuilder
-
getCompletedGraph
Description copied from interface:HnswBuilderOnce this method is called no further updates to the graph are accepted (addGraphNode will throw IllegalStateException). Final modifications to the graph (eg patching up disconnected components, re-ordering node ids for better delta compression) may be triggered, so callers should expect this call to take some time.- Specified by:
getCompletedGraphin interfaceHnswBuilder- Throws:
IOException
-
getGraph
- Specified by:
getGraphin interfaceHnswBuilder
-