dweiss commented on code in PR #11743:
URL: https://github.com/apache/lucene/pull/11743#discussion_r962606272


##########
lucene/core/src/test/org/apache/lucene/util/hnsw/TestHnswGraph.java:
##########
@@ -74,12 +74,8 @@ public void setup() {
     similarityFunction =
         VectorSimilarityFunction.values()[
             random().nextInt(VectorSimilarityFunction.values().length - 1) + 
1];
-    if (similarityFunction == VectorSimilarityFunction.DOT_PRODUCT) {
-      vectorEncoding =
-          
VectorEncoding.values()[random().nextInt(VectorEncoding.values().length - 1) + 
1];
-    } else {
-      vectorEncoding = VectorEncoding.FLOAT32;
-    }
+    vectorEncoding =
+        
VectorEncoding.values()[random().nextInt(VectorEncoding.values().length - 1) + 
1];

Review Comment:
   Or RandomizedTest.randomFrom(VectorEncoding.values()) - there should be a 
method that delegates to the current context.
   
   The above code seems to pick from the range of [1, len) - not sure if this 
is intentional but zero index will never happen.



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