Package org.apache.lucene.util.hnsw
Class HnswGraphBuilder
- java.lang.Object
-
- org.apache.lucene.util.hnsw.HnswGraphBuilder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HnswGraphBuilder.GraphBuilderKnnCollector
A restricted, specialized knnCollector that can be used when building a graph.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BEAM_WIDTH
Default number of the size of the queue maintained while searching during a graph construction.static int
DEFAULT_MAX_CONN
Default number of maximum connections per nodestatic String
HNSW_COMPONENT
A name for the HNSW component for the info-stream *static long
randSeed
Random seed for level generation; public to expose for testing *
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGraphNode(int node)
Inserts a doc with vector value to the graphOnHeapHnswGraph
build(int maxOrd)
Adds all nodes to the graph up to the providedmaxOrd
.static HnswGraphBuilder
create(RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, long seed)
static HnswGraphBuilder
create(RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, long seed, HnswGraph initializerGraph, Map<Integer,Integer> oldToNewOrdinalMap)
OnHeapHnswGraph
getGraph()
void
setInfoStream(InfoStream infoStream)
Set info-stream to output debugging information *
-
-
-
Field Detail
-
DEFAULT_MAX_CONN
public static final int DEFAULT_MAX_CONN
Default number of maximum connections per node- See Also:
- Constant Field Values
-
DEFAULT_BEAM_WIDTH
public static final int DEFAULT_BEAM_WIDTH
Default number of the size of the queue maintained while searching during a graph construction.- See Also:
- Constant Field Values
-
HNSW_COMPONENT
public static final String HNSW_COMPONENT
A name for the HNSW component for the info-stream *- See Also:
- Constant Field Values
-
randSeed
public static long randSeed
Random seed for level generation; public to expose for testing *
-
-
Method Detail
-
create
public static HnswGraphBuilder create(RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, long seed) throws IOException
- Throws:
IOException
-
create
public static HnswGraphBuilder create(RandomVectorScorerSupplier scorerSupplier, int M, int beamWidth, long seed, HnswGraph initializerGraph, Map<Integer,Integer> oldToNewOrdinalMap) throws IOException
- Throws:
IOException
-
build
public OnHeapHnswGraph build(int maxOrd) throws IOException
Adds all nodes to the graph up to the providedmaxOrd
.- Parameters:
maxOrd
- The maximum ordinal of the nodes to be added.- Throws:
IOException
-
setInfoStream
public void setInfoStream(InfoStream infoStream)
Set info-stream to output debugging information *
-
getGraph
public OnHeapHnswGraph getGraph()
-
addGraphNode
public void addGraphNode(int node) throws IOException
Inserts a doc with vector value to the graph- Throws:
IOException
-
-