mayya-sharipova commented on a change in pull request #416: URL: https://github.com/apache/lucene/pull/416#discussion_r783195370
########## File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsReader.java ########## @@ -464,30 +477,45 @@ private void readValue(int targetOrd) throws IOException { /** Read the nearest-neighbors graph from the index input */ private static final class IndexedKnnGraphReader extends KnnGraphValues { - final FieldEntry entry; final IndexInput dataIn; + final int[][] nodesByLevel; + final long[] graphOffsetsByLevel; + final int numLevels; + final int entryNode; + final int size; + final long bytesForConns; int arcCount; int arcUpTo; int arc; IndexedKnnGraphReader(FieldEntry entry, IndexInput dataIn) { - this.entry = entry; this.dataIn = dataIn; + this.nodesByLevel = entry.nodesByLevel; + this.numLevels = entry.numLevels; + this.entryNode = numLevels > 1 ? nodesByLevel[numLevels - 1][0] : 0; + this.size = entry.size(); + this.graphOffsetsByLevel = entry.graphOffsetsByLevel; + this.bytesForConns = ((long) entry.maxConn + 1) * 4; } @Override - public void seek(int targetOrd) throws IOException { + public void seek(int level, int targetOrd) throws IOException { + int targetIndex = + level == 0 + ? targetOrd + : Arrays.binarySearch(nodesByLevel[level], 0, nodesByLevel[level].length, targetOrd); + long graphDataOffset = graphOffsetsByLevel[level] + targetIndex * bytesForConns; Review comment: I've added the assertion for this check in 5e42f220c9c35ed0ec567bd2b760c6cbe21671f4 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org