You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ju...@apache.org on 2021/11/11 19:36:42 UTC

[lucene] branch main updated: LUCENE-10063: Fix score calculation in SimpleTextKnnVectorsFormat

This is an automated email from the ASF dual-hosted git repository.

julietibs pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 2a9adb8  LUCENE-10063: Fix score calculation in SimpleTextKnnVectorsFormat
2a9adb8 is described below

commit 2a9adb81df314ffeb92951bbf2d99fecc94fa581
Author: Julie Tibshirani <ju...@apache.org>
AuthorDate: Thu Nov 11 10:13:09 2021 -0800

    LUCENE-10063: Fix score calculation in SimpleTextKnnVectorsFormat
    
    The method VectorSimilarityFunction#convertToScore already reverses the
    similarity, so we shouldn't reverse it again.
---
 .../apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java    | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
index 852c1f1..4ef585e 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextKnnVectorsReader.java
@@ -160,9 +160,6 @@ public class SimpleTextKnnVectorsReader extends KnnVectorsReader {
       }
       float[] vector = values.vectorValue();
       float score = vectorSimilarity.convertToScore(vectorSimilarity.compare(vector, target));
-      if (vectorSimilarity.reversed) {
-        score = 1 / (score + 1);
-      }
       topK.insertWithOverflow(new ScoreDoc(doc, score));
     }
     ScoreDoc[] topScoreDocs = new ScoreDoc[topK.size()];