- java.lang.Object
-
- org.apache.lucene.util.hnsw.IncrementalHnswGraphMerger
-
- org.apache.lucene.util.hnsw.ConcurrentHnswMerger
-
- All Implemented Interfaces:
HnswGraphMerger
public class ConcurrentHnswMerger extends IncrementalHnswGraphMerger
This merger merges graph in a concurrent manner, by usingHnswConcurrentMergeBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private int
numWorker
private TaskExecutor
taskExecutor
-
Fields inherited from class org.apache.lucene.util.hnsw.IncrementalHnswGraphMerger
beamWidth, fieldInfo, initDocMap, initGraphSize, initReader, M, scorerSupplier
-
-
Constructor Summary
Constructors Constructor Description ConcurrentHnswMerger(FieldInfo fieldInfo, RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, TaskExecutor taskExecutor, int numWorker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HnswBuilder
createBuilder(DocIdSetIterator mergedVectorIterator, int maxOrd)
Builds a new HnswGraphBuilder using the biggest graph from the merge state as a starting point.-
Methods inherited from class org.apache.lucene.util.hnsw.IncrementalHnswGraphMerger
addReader, getNewOrdMapping, merge
-
-
-
-
Field Detail
-
taskExecutor
private final TaskExecutor taskExecutor
-
numWorker
private final int numWorker
-
-
Constructor Detail
-
ConcurrentHnswMerger
public ConcurrentHnswMerger(FieldInfo fieldInfo, RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, TaskExecutor taskExecutor, int numWorker)
- Parameters:
fieldInfo
- FieldInfo for the field being merged
-
-
Method Detail
-
createBuilder
protected HnswBuilder createBuilder(DocIdSetIterator mergedVectorIterator, int maxOrd) throws java.io.IOException
Description copied from class:IncrementalHnswGraphMerger
Builds a new HnswGraphBuilder using the biggest graph from the merge state as a starting point. If no valid readers were added to the merge state, a new graph is created.- Overrides:
createBuilder
in classIncrementalHnswGraphMerger
- Parameters:
mergedVectorIterator
- iterator over the vectors in the merged segmentmaxOrd
- max num of vectors that will be merged into the graph- Returns:
- HnswGraphBuilder
- Throws:
java.io.IOException
- If an error occurs while reading from the merge state
-
-