Module org.apache.lucene.core
Package org.apache.lucene.util.hnsw
Class HnswGraphSearcher.OnHeapHnswGraphSearcher
- java.lang.Object
-
- org.apache.lucene.util.hnsw.HnswGraphSearcher
-
- org.apache.lucene.util.hnsw.HnswGraphSearcher.OnHeapHnswGraphSearcher
-
- Enclosing class:
- HnswGraphSearcher
private static class HnswGraphSearcher.OnHeapHnswGraphSearcher extends HnswGraphSearcher
This class allowsOnHeapHnswGraph
to be searched in a thread-safe manner by avoiding the unsafe methods (seek and nextNeighbor, which maintain state in the graph object) and instead maintaining the state in the searcher object.Note the class itself is NOT thread safe, but since each search will create a new Searcher, the search methods using this class are thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description private NeighborArray
cur
private int
upto
-
Constructor Summary
Constructors Modifier Constructor Description private
OnHeapHnswGraphSearcher(NeighborQueue candidates, BitSet visited)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
graphNextNeighbor(HnswGraph graph)
Get the next neighbor from the graph, you must callHnswGraphSearcher.graphSeek(HnswGraph, int, int)
before calling this method.(package private) void
graphSeek(HnswGraph graph, int level, int targetNode)
Seek a specific node in the given graph.-
Methods inherited from class org.apache.lucene.util.hnsw.HnswGraphSearcher
search, search, searchLevel, searchLevel
-
-
-
-
Field Detail
-
cur
private NeighborArray cur
-
upto
private int upto
-
-
Constructor Detail
-
OnHeapHnswGraphSearcher
private OnHeapHnswGraphSearcher(NeighborQueue candidates, BitSet visited)
-
-
Method Detail
-
graphSeek
void graphSeek(HnswGraph graph, int level, int targetNode)
Description copied from class:HnswGraphSearcher
Seek a specific node in the given graph. The default implementation will just callHnswGraph.seek(int, int)
- Overrides:
graphSeek
in classHnswGraphSearcher
-
graphNextNeighbor
int graphNextNeighbor(HnswGraph graph)
Description copied from class:HnswGraphSearcher
Get the next neighbor from the graph, you must callHnswGraphSearcher.graphSeek(HnswGraph, int, int)
before calling this method. The default implementation will just callHnswGraph.nextNeighbor()
- Overrides:
graphNextNeighbor
in classHnswGraphSearcher
- Returns:
- see
HnswGraph.nextNeighbor()
-
-