Fix TestFeatureField#testBasicsNonScoringCase test (#12130)

Sometimes the random search lucene test searcher will wrap the reader. Consequently, we need to make sure to use the reader provided by the test IndexSearcher or the reader may be different between creating the weight with the searcher vs. accessing the leaf context for the scorer.
This commit is contained in:
Benjamin Trent 2023-02-06 10:15:00 -05:00 committed by GitHub
parent 4bbc273a43
commit c2bef381d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ public class TestFeatureField extends LuceneTestCase {
writer.close();
IndexSearcher searcher = LuceneTestCase.newSearcher(reader);
LeafReaderContext context = reader.leaves().get(0);
LeafReaderContext context = searcher.getIndexReader().leaves().get(0);
Query q = FeatureField.newLogQuery("features", "pagerank", 3f, 4.5f);
Weight w = q.createWeight(searcher, ScoreMode.TOP_SCORES, 2);
@ -408,7 +408,7 @@ public class TestFeatureField extends LuceneTestCase {
}
IndexSearcher searcher = LuceneTestCase.newSearcher(reader);
LeafReaderContext context = reader.leaves().get(0);
LeafReaderContext context = searcher.getIndexReader().leaves().get(0);
for (Query q :
List.of(