Class Lucene91HnswVectorsReader.OffHeapHnswGraph
- java.lang.Object
-
- org.apache.lucene.util.hnsw.HnswGraph
-
- org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsReader.OffHeapHnswGraph
-
- Enclosing class:
- Lucene91HnswVectorsReader
private static final class Lucene91HnswVectorsReader.OffHeapHnswGraph extends HnswGraph
Read the nearest-neighbors graph from the index input
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.util.hnsw.HnswGraph
HnswGraph.ArrayNodesIterator, HnswGraph.CollectionNodesIterator, HnswGraph.NodesIterator
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
arc
(package private) int
arcCount
(package private) int
arcUpTo
(package private) long
bytesForConns
(package private) IndexInput
dataIn
(package private) int
entryNode
(package private) long[]
graphOffsetsByLevel
(package private) int[][]
nodesByLevel
(package private) int
numLevels
(package private) int
size
-
Constructor Summary
Constructors Constructor Description OffHeapHnswGraph(Lucene91HnswVectorsReader.FieldEntry entry, IndexInput dataIn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
entryNode()
Returns graph's entry point on the top level *HnswGraph.NodesIterator
getNodesOnLevel(int level)
Get all nodes on a given level as node 0th ordinalsint
nextNeighbor()
Iterates over the neighbor list.int
numLevels()
Returns the number of levels of the graphvoid
seek(int level, int targetOrd)
Move the pointer to exactly the givenlevel
'starget
.int
size()
Returns the number of nodes in the graph
-
-
-
Field Detail
-
dataIn
final IndexInput dataIn
-
nodesByLevel
final int[][] nodesByLevel
-
graphOffsetsByLevel
final long[] graphOffsetsByLevel
-
numLevels
final int numLevels
-
entryNode
final int entryNode
-
size
final int size
-
bytesForConns
final long bytesForConns
-
arcCount
int arcCount
-
arcUpTo
int arcUpTo
-
arc
int arc
-
-
Constructor Detail
-
OffHeapHnswGraph
OffHeapHnswGraph(Lucene91HnswVectorsReader.FieldEntry entry, IndexInput dataIn)
-
-
Method Detail
-
seek
public void seek(int level, int targetOrd) throws java.io.IOException
Description copied from class:HnswGraph
Move the pointer to exactly the givenlevel
'starget
. After this method returns, callHnswGraph.nextNeighbor()
to return successive (ordered) connected node ordinals.- Specified by:
seek
in classHnswGraph
- Parameters:
level
- level of the graphtargetOrd
- ordinal of a node in the graph, must be ≥ 0 and <FloatVectorValues.size()
.- Throws:
java.io.IOException
-
size
public int size()
Description copied from class:HnswGraph
Returns the number of nodes in the graph
-
nextNeighbor
public int nextNeighbor() throws java.io.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 callingHnswGraph.seek(int, int)
, which resets the iterator.- Specified by:
nextNeighbor
in classHnswGraph
- Returns:
- a node ordinal in the graph, or NO_MORE_DOCS if the iteration is complete.
- Throws:
java.io.IOException
-
numLevels
public int numLevels()
Description copied from class:HnswGraph
Returns the number of levels of the graph
-
entryNode
public int entryNode()
Description copied from class:HnswGraph
Returns graph's entry point on the top level *
-
getNodesOnLevel
public HnswGraph.NodesIterator getNodesOnLevel(int level)
Description copied from class:HnswGraph
Get all nodes on a given level as node 0th ordinals- Specified by:
getNodesOnLevel
in classHnswGraph
- Parameters:
level
- level for which to get all nodes- Returns:
- an iterator over nodes where
nextInt
returns a next node on the level
-
-