Module org.apache.lucene.core
Class Lucene95HnswVectorsReader.OffHeapHnswGraph
java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph
org.apache.lucene.codecs.lucene95.Lucene95HnswVectorsReader.OffHeapHnswGraph
- Enclosing class:
- Lucene95HnswVectorsReader
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.NodesIterator
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
(package private) int
(package private) int
private final int[]
(package private) final IndexInput
(package private) final int
private final long[]
private final DirectMonotonicReader
(package private) final int[][]
(package private) final int
(package private) final int
-
Constructor Summary
ConstructorsConstructorDescriptionOffHeapHnswGraph
(Lucene95HnswVectorsReader.FieldEntry entry, IndexInput vectorIndex) -
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 -
numLevels
final int numLevels -
entryNode
final int entryNode -
size
final int size -
arcCount
int arcCount -
arcUpTo
int arcUpTo -
arc
int arc -
graphLevelNodeOffsets
-
graphLevelNodeIndexOffsets
private final long[] graphLevelNodeIndexOffsets -
currentNeighborsBuffer
private final int[] currentNeighborsBuffer
-
-
Constructor Details
-
OffHeapHnswGraph
OffHeapHnswGraph(Lucene95HnswVectorsReader.FieldEntry entry, IndexInput vectorIndex) throws IOException - Throws:
IOException
-
-
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
Description copied from class:HnswGraph
Returns the number of levels of the graph- Specified by:
numLevels
in classHnswGraph
- Throws:
IOException
-
entryNode
Description copied from class:HnswGraph
Returns graph's entry point on the top level *- Specified by:
entryNode
in classHnswGraph
- Throws:
IOException
-
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
-