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


##########
lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java:
##########
@@ -288,15 +288,20 @@ public void visit(QueryVisitor visitor) {
 
   @Override
   public boolean equals(Object obj) {
-    return sameClassAs(obj)
-        && ((KnnVectorQuery) obj).k == k
-        && ((KnnVectorQuery) obj).field.equals(field)
-        && Arrays.equals(((KnnVectorQuery) obj).target, target);
+    if (sameClassAs(obj) == false) {
+      return false;
+    }
+    return ((KnnVectorQuery) obj).k == k
+            && ((KnnVectorQuery) obj).field.equals(field)
+            && Arrays.equals(((KnnVectorQuery) obj).target, target)
+            && ((KnnVectorQuery) obj).filter == null
+        ? filter == null

Review Comment:
   How about using Objects.equals(filter, ((KnnVectorQuery) obj).filter)? This 
will handle the null==null case



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