You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/07/20 17:55:40 UTC

[GitHub] [lucene] jtibshirani commented on a change in pull request #219: LUCENE-10015: Remove VectorSimilarityFunction#NONE.

jtibshirani commented on a change in pull request #219:
URL: https://github.com/apache/lucene/pull/219#discussion_r673356722



##########
File path: lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java
##########
@@ -62,15 +64,5 @@
    * @param v2 another vector, of the same dimension
    * @return the value of the similarity function applied to the two vectors
    */
-  public float compare(float[] v1, float[] v2) {
-    switch (this) {
-      case EUCLIDEAN:
-        return squareDistance(v1, v2);
-      case DOT_PRODUCT:
-        return dotProduct(v1, v2);
-      case NONE:
-      default:
-        throw new IllegalStateException("Incomparable similarity function: " + this);
-    }
-  }
+  public abstract float compare(float[] v1, float[] v2);

Review comment:
       nice refactor :)




-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org