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


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java:
##########
@@ -29,16 +29,27 @@
  * @lucene.internal
  */
 public class NeighborArray {
+  static final int UNCHECKED_NODE_INIT_SIZE = 4;
   private final boolean scoresDescOrder;
   private int size;
 
   float[] score;
   int[] node;
+  final NeighborArray uncheckedNodes;
 
   public NeighborArray(int maxSize, boolean descOrder) {
+    this(maxSize, descOrder, false);
+  }
+
+  public NeighborArray(int maxSize, boolean descOrder, boolean 
tracUncheckedNodes) {

Review Comment:
   I'm finding it difficult to keep track of what these booleans mean. It's 
especially confusing when there are two of them. Is it possible to make this 
ctor (or the other one) private? Do we only call this with 
`tracUncheckedNodes==false` from here?  



##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborArray.java:
##########
@@ -62,7 +73,7 @@ public void add(int newNode, float newScore) {
   }
 
   /** Add a new node to the NeighborArray into a correct sort position 
according to its score. */
-  public void insertSorted(int newNode, float newScore) {
+  public void insertSorted(int newNode, float newScore, boolean setUncheck) {

Review Comment:
   again can we simplify the API getting rid of this boolean parameter? We 
could eg make a private method accepting the boolean and then two public 
methods: `insertSortedNoTracking` and `insertSortedWithTracking`?



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