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:40:55 UTC

[lucene] branch branch_9x 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 branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


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

commit 68be365283e482e608f21ee2eda14a094614b93e
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()];