HnswGraphSearcher
open class HnswGraphSearcher(candidates: NeighborQueue, visited: BitSet) : AbstractHnswGraphSearcher
Searches an HNSW graph to find nearest neighbors to a query vector. For more background on the search algorithm, see HnswGraph.
Inheritors
Functions
Link copied to clipboard
open override fun findBestEntryPoint(scorer: RandomVectorScorer, graph: HnswGraph, collector: KnnCollector): IntArray
Function to find the best entry point from which to search the zeroth graph layer.
Link copied to clipboard
Link copied to clipboard
Search the graph for the given scorer. Gathering results in the provided collector that pass the provided acceptOrds.
Link copied to clipboard
fun searchLevel(scorer: RandomVectorScorer, topK: Int, level: Int, eps: IntArray, graph: HnswGraph): HnswGraphBuilder.GraphBuilderKnnCollector
Searches for the nearest neighbors of a query vector in a given level.
open override fun searchLevel(results: KnnCollector, scorer: RandomVectorScorer, level: Int, eps: IntArray, graph: HnswGraph, acceptOrds: Bits?)
Add the closest neighbors found to a priority queue (heap). These are returned in REVERSE proximity order -- the most distant neighbor of the topK found, i.e. the one with the lowest score/comparison value, will be at the top of the heap, while the closest neighbor will be the last to be popped.