Class Lucene99HnswVectorsReader.OffHeapHnswGraph

java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsReader.OffHeapHnswGraph
Enclosing class:
Lucene99HnswVectorsReader

private static final class Lucene99HnswVectorsReader.OffHeapHnswGraph extends HnswGraph
Read the nearest-neighbors graph from the index input
  • Field Details

    • dataIn

      final IndexInput dataIn
    • nodesByLevel

      final int[][] nodesByLevel
    • numLevels

      final int numLevels
    • entryNode

      final int entryNode
    • size

      final int size
    • arcCount

      int arcCount
    • arcUpTo

      int arcUpTo
    • arc

      int arc
    • graphLevelNodeOffsets

      private final DirectMonotonicReader graphLevelNodeOffsets
    • graphLevelNodeIndexOffsets

      private final long[] graphLevelNodeIndexOffsets
    • currentNeighborsBuffer

      private final int[] currentNeighborsBuffer
  • Constructor Details

  • Method Details

    • seek

      public void seek(int level, int targetOrd) throws IOException
      Description copied from class: HnswGraph
      Move the pointer to exactly the given level's target. After this method returns, call HnswGraph.nextNeighbor() to return successive (ordered) connected node ordinals.
      Specified by:
      seek in class HnswGraph
      Parameters:
      level - level of the graph
      targetOrd - ordinal of a node in the graph, must be ≥ 0 and < KnnVectorValues.size().
      Throws:
      IOException
    • size

      public int size()
      Description copied from class: HnswGraph
      Returns the number of nodes in the graph
      Specified by:
      size in class HnswGraph
    • nextNeighbor

      public int nextNeighbor() throws IOException
      Description copied from class: HnswGraph
      Iterates over the neighbor list. It is illegal to call this method after it returns NO_MORE_DOCS without calling HnswGraph.seek(int, int), which resets the iterator.
      Specified by:
      nextNeighbor in class HnswGraph
      Returns:
      a node ordinal in the graph, or NO_MORE_DOCS if the iteration is complete.
      Throws:
      IOException
    • numLevels

      public int numLevels() throws IOException
      Description copied from class: HnswGraph
      Returns the number of levels of the graph
      Specified by:
      numLevels in class HnswGraph
      Throws:
      IOException
    • entryNode

      public int entryNode() throws IOException
      Description copied from class: HnswGraph
      Returns graph's entry point on the top level *
      Specified by:
      entryNode in class HnswGraph
      Throws:
      IOException
    • getNodesOnLevel

      public HnswGraph.NodesIterator getNodesOnLevel(int level)
      Description copied from class: HnswGraph
      Get all nodes on a given level as node 0th ordinals. The nodes are NOT guaranteed to be presented in any particular order.
      Specified by:
      getNodesOnLevel in class HnswGraph
      Parameters:
      level - level for which to get all nodes
      Returns:
      an iterator over nodes where nextInt returns a next node on the level