Class Lucene90OnHeapHnswGraph


  • public final class Lucene90OnHeapHnswGraph
    extends HnswGraph
    An HnswGraph where all nodes and connections are held in memory. This class is used to construct the HNSW graph before it's written to the index.
    • Method Detail

      • search

        public static NeighborQueue search​(float[] query,
                                           int topK,
                                           int numSeed,
                                           RandomAccessVectorValues vectors,
                                           VectorSimilarityFunction similarityFunction,
                                           HnswGraph graphValues,
                                           Bits acceptOrds,
                                           int visitedLimit,
                                           SplittableRandom random)
                                    throws IOException
        Searches for the nearest neighbors of a query vector.
        Parameters:
        query - search query vector
        topK - the number of nodes to be returned
        numSeed - the size of the queue maintained while searching, and controls the number of random entry points to sample
        vectors - vector values
        graphValues - the graph values. May represent the entire graph, or a level in a hierarchical graph.
        acceptOrds - Bits that represents the allowed document ordinals to match, or null if they are all allowed to match.
        random - a source of randomness, used for generating entry points to the graph
        Returns:
        a priority queue holding the closest neighbors found
        Throws:
        IOException
      • getNeighbors

        public Lucene90NeighborArray getNeighbors​(int node)
        Returns the NeighborQueue connected to the given node.
        Parameters:
        node - the node whose neighbors are returned
      • size

        public int size()
        Specified by:
        size in class HnswGraph
      • seek

        public void seek​(int level,
                         int targetNode)
        Specified by:
        seek in class HnswGraph