thecoop commented on code in PR #16728:
URL: https://github.com/apache/lucene/pull/16728#discussion_r4135373921


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -504,6 +505,14 @@ private boolean[] selectAndLinkDiverse(
         // here we don't need to lock, because there's no incoming link so no 
others is able to
         // discover this node such that no others will modify this neighbor 
array as well
         if (isLinkRepair) {
+          // there's a very small chance this is trying to add a duplicate 
node,
+          // if the scoring function is estimated and the highest score is NOT
+          // the identity function (which would already be filtered out by 
diversityCheck)
+          for (int j = 0; j < neighbors.size(); j++) {
+            if (neighbors.nodes()[j] == node) {
+              continue cands;
+            }
+          }

Review Comment:
   I've pulled it out into a separate method



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