shubhamvishu commented on code in PR #14963:
URL: https://github.com/apache/lucene/pull/14963#discussion_r2446070317
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java:
##########
@@ -575,16 +612,26 @@ static int distFuncToOrd(VectorSimilarityFunction func) {
throw new IllegalArgumentException("invalid distance function: " + func);
}
+ private static boolean shouldCreateGraph(int k, int numNodes) {
+ int expectedVisitedNodes = expectedVisitedNodes(k, numNodes);
+ return (numNodes > expectedVisitedNodes && expectedVisitedNodes > 0) || k
< 0;
Review Comment:
`|| k <0` was required since when passing `-1` the `expectedVisitedNodes`
was returning a negative value making this function to eventually return false
with -1 threshold which was exactly opposite of what we intended for when using
-1. But just allowing 0 or higher would make this simpler as you said below.
--
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]