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/10/11 15:18:15 UTC

[GitHub] [lucene] mayya-sharipova commented on a change in pull request #366: LUCENE-10146: Add VectorSimilarityFunction.COSINE

mayya-sharipova commented on a change in pull request #366:
URL: https://github.com/apache/lucene/pull/366#discussion_r726206695



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90FieldInfosFormat.java
##########
@@ -99,11 +99,12 @@
  *   <li>PointDimensionCount, PointNumBytes: these are non-zero only if the field is indexed as
  *       points, e.g. using {@link org.apache.lucene.document.LongPoint}
  *   <li>VectorDimension: it is non-zero if the field is indexed as vectors.
- *   <li>VectorDistFunction: a byte containing distance function used for similarity calculation.
+ *   <li>VectorSimilarityFunction: a byte containing distance function used for similarity
+ *       calculation.
  *       <ul>
- *         <li>0: no distance function is defined for this field.
- *         <li>1: EUCLIDEAN_HNSW distance. ({@link VectorSimilarityFunction#EUCLIDEAN})
- *         <li>2: DOT_PRODUCT_HNSW score. ({@link VectorSimilarityFunction#DOT_PRODUCT})
+ *         <li>0: EUCLIDEAN distance. ({@link VectorSimilarityFunction#EUCLIDEAN})
+ *         <li>1: DOT_PRODUCT similarity. ({@link VectorSimilarityFunction#DOT_PRODUCT})
+ *         <li>2: COSINE similarity. ({@link VectorSimilarityFunction#COSINE})

Review comment:
       Good notice! 
   
    As we store the enum `VectorSimilarityFunction`'s  ordinal  in `Lucene90HnswVectorsWriter` on disk, declaration order in the enum `VectorSimilarityFunction`  is very important, and we should not allow any modifications that change this order.
   
   May be we can write an extra test for `VectorSimilarityFunction` that test for each ordinal we return an expected similarity, e.g. ` VectorSimilarityFunction.values()[0]` always returns `EUCLIDEAN` etc.




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