Class Lucene91HnswVectorsReader.OffHeapHnswGraph
java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph
org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsReader.OffHeapHnswGraph
- Enclosing class:
- Lucene91HnswVectorsReader
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
FieldsModifier and TypeFieldDescription(package private) int
(package private) int
(package private) int
(package private) final long
(package private) final IndexInput
(package private) final int
(package private) final long[]
(package private) final int[][]
(package private) final int
(package private) final int
-
Constructor Summary
ConstructorsConstructorDescriptionOffHeapHnswGraph
(Lucene91HnswVectorsReader.FieldEntry entry, IndexInput dataIn) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns graph's entry point on the top level *getNodesOnLevel
(int level) Get all nodes on a given level as node 0th ordinalsint
Iterates over the neighbor list.int
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 Details
-
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 Details
-
OffHeapHnswGraph
OffHeapHnswGraph(Lucene91HnswVectorsReader.FieldEntry entry, IndexInput dataIn)
-
-
Method Details
-
seek
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:
IOException
-
size
public int size()Description copied from class:HnswGraph
Returns the number of nodes in the graph -
nextNeighbor
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:
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
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
-