uschindler commented on code in PR #13076:
URL: https://github.com/apache/lucene/pull/13076#discussion_r1480537766


##########
lucene/core/src/java/org/apache/lucene/util/VectorUtil.java:
##########
@@ -214,4 +214,18 @@ public static float[] checkFinite(float[] v) {
     }
     return v;
   }
+
+  public static int binaryHammingDistance(byte[] a, byte[] b) {

Review Comment:
   Here are the length checks missing:
   
   ```java
       if (a.length != b.length) {
         throw new IllegalArgumentException("vector dimensions differ: " + 
a.length + "!=" + b.length);
       }
   ```
   
   Maybe add a private utility method for `byte[]` and `float[]` to minimize 
the code duplication.



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