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


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -374,18 +374,26 @@ void addDiverseNeighbors(
       if (hnswLock != null) {
         Lock lock = hnswLock.write(level, nbr);
         try {
-          NeighborArray nbrsOfNbr = getGraph().getNeighbors(level, nbr);
-          nbrsOfNbr.addAndEnsureDiversity(node, candidates.getScores(i), nbr, 
scorer);
+          updateNeighbor(
+              getGraph().getNeighbors(level, nbr), node, 
candidates.getScores(i), nbr, scorer);
         } finally {
           lock.unlock();
         }
       } else {
-        NeighborArray nbrsOfNbr = hnsw.getNeighbors(level, nbr);
-        nbrsOfNbr.addAndEnsureDiversity(node, candidates.getScores(i), nbr, 
scorer);
+        updateNeighbor(hnsw.getNeighbors(level, nbr), node, 
candidates.getScores(i), nbr, scorer);

Review Comment:
   Is it possible to make this conditional on whether we're being called by the 
link repair process?  We could add a parameter controlling whether the check is 
done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to