From 769c3f319c06ab256e3265cb7d1f778ae67570b8 Mon Sep 17 00:00:00 2001 From: Alan Woodward Date: Wed, 11 Oct 2023 14:58:57 +0100 Subject: [PATCH] Don't use an asserting searcher at all in MatchingDirectoryReader (#100668) Follow up to #100527 We are not testing anything to do with searching with this searcher, and so there is no point in using LuceneTestCase.newSearcher() which will wrap it with all sorts of extra checks that may access the underlying reader in ways that are not anticipated by tests. Fixes #100460 Fixes #99024 --- .../java/org/elasticsearch/index/engine/EngineTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java b/test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java index 17f2303eb84c8..ab9d80b801863 100644 --- a/test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java @@ -1509,7 +1509,7 @@ public MatchingDirectoryReader(DirectoryReader in, Query query) throws IOExcepti @Override public LeafReader wrap(LeafReader leaf) { try { - final IndexSearcher searcher = newSearcher(leaf, false, true, false); + final IndexSearcher searcher = new IndexSearcher(leaf); searcher.setQueryCache(null); final Weight weight = searcher.createWeight(query, ScoreMode.COMPLETE_NO_SCORES, 1.0f); final Scorer scorer = weight.scorer(leaf.getContext());