LUCENE-10063: Fix score calculation in SimpleTextKnnVectorsFormat

The method VectorSimilarityFunction#convertToScore already reverses the
similarity, so we shouldn't reverse it again.
This commit is contained in:
Julie Tibshirani 2021-11-11 10:13:09 -08:00
parent f725b27e12
commit 2a9adb81df
1 changed files with 0 additions and 3 deletions

View File

@ -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()];