mayya-sharipova commented on code in PR #862: URL: https://github.com/apache/lucene/pull/862#discussion_r865134562
########## lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java: ########## @@ -72,8 +103,39 @@ public void removeLast() { size--; } + public void removeIndex(int idx) { + System.arraycopy(node, idx + 1, node, idx, size - idx); + System.arraycopy(score, idx + 1, score, idx, size - idx); + size--; + } + @Override public String toString() { return "NeighborArray[" + size + "]"; } + + private int ascSortFindRightMostInsertionPoint(float newScore) { + int insertionPoint = Arrays.binarySearch(score, 0, size, newScore); + if (insertionPoint >= 0) { + // find the right most position with the same score Review Comment: Thanks for a suggestion, it is indeed a good suggestion, I have not thought about this. But considering it is relatively rare to have duplicates in vectors, I opt for keeping the current code. -- 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