Fix TophitsAggregatorTests

It needs a DirectoryReader so it has to be careful.

Closes #22818
This commit is contained in:
Nik Everett 2017-01-26 14:07:19 -05:00
parent 33fd1a606b
commit 1baa884ab7

View File

@ -130,7 +130,8 @@ public class TopHitsAggregatorTests extends AggregatorTestCase {
iw.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
// We do not use LuceneTestCase.newSearcher because we need a DirectoryReader for "testInsideTerms"
IndexSearcher indexSearcher = new IndexSearcher(indexReader);
Aggregation result = searchAndReduce(indexSearcher, query, builder, STRING_FIELD_TYPE);
indexReader.close();