zhaih commented on code in PR #12235:
URL: https://github.com/apache/lucene/pull/12235#discussion_r1179964872


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java:
##########
@@ -59,23 +61,72 @@ public void add(int newNode, float newScore) {
     node[size] = newNode;
     score[size] = newScore;
     ++size;
+    ++sortedNodeSize;
   }
 
-  /** Add a new node to the NeighborArray into a correct sort position 
according to its score. */
-  public void insertSorted(int newNode, float newScore) {
+  /** Add node and score but do not insert as sorted */
+  public void addOutOfOrder(int newNode, float newScore) {
     if (size == node.length) {
       node = ArrayUtil.grow(node);
       score = ArrayUtil.growExact(score, node.length);
     }
+    node[size] = newNode;
+    score[size] = newScore;
+    size++;
+  }
+
+  /**
+   * Sort the array according to scores, and return the sorted indexes of 
previous unsorted nodes
+   * (unchecked nodes)
+   *
+   * @return indexes of newly sorted (unchecked) nodes, in ascending order, or 
null if the array is
+   *     already fully sorted
+   */
+  public int[] sort() {

Review Comment:
   Haha I'll just leave it as is. It claims itself is "sort" and it does the 
sort, but just return something different :)



-- 
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

Reply via email to