GITHUB-12181: fix false-positive TestKnnFloatVectorQuery.testDocAndScoreQueryBasics() failure (#12182)

This commit is contained in:
Christine Poerschke 2023-03-06 15:29:36 +00:00 committed by GitHub
parent e0d92eef98
commit 3bd06b1cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -201,11 +201,12 @@ public class TestKnnFloatVectorQuery extends BaseKnnVectorQueryTestCase {
scores[i] = scoreDocs[i].score;
maxScore = Math.max(maxScore, scores[i]);
}
int[] segments = AbstractKnnVectorQuery.findSegmentStarts(reader, docs);
IndexReader indexReader = searcher.getIndexReader();
int[] segments = AbstractKnnVectorQuery.findSegmentStarts(indexReader, docs);
AbstractKnnVectorQuery.DocAndScoreQuery query =
new AbstractKnnVectorQuery.DocAndScoreQuery(
docs, scores, maxScore, segments, reader.getContext().id());
docs, scores, maxScore, segments, indexReader.getContext().id());
final Weight w = query.createWeight(searcher, ScoreMode.TOP_SCORES, 1.0f);
TopDocs topDocs = searcher.search(query, 100);
assertEquals(scoreDocs.length, topDocs.totalHits.value);