Skip to content

Commit

Permalink
GITHUB-12181: fix false-positive TestKnnFloatVectorQuery.testDocAndSc…
Browse files Browse the repository at this point in the history
…oreQueryBasics() failure (#12182)

(cherry picked from commit 3bd06b1)

Resolved Conflicts:
	lucene/core/src/test/org/apache/lucene/search/TestKnnFloatVectorQuery.java
  • Loading branch information
cpoerschke committed Mar 6, 2023
1 parent 5ff8ea4 commit caf55e0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ public void testDocAndScoreQueryBasics() throws IOException {
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(
scoreDocs.length, docs, scores, segments, reader.getContext().id());
scoreDocs.length, docs, scores, 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);
Expand Down

0 comments on commit caf55e0

Please sign in to comment.