msokolov commented on code in PR #862: URL: https://github.com/apache/lucene/pull/862#discussion_r865039829
########## 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: oh, tricky. Maybe we could search with newScore + (smallest float)? But this is fine and is probably occurring very rarely/never anyway -- 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