[Rollup] Don't use lucene's newSearcher() method in tests

Use AggregatorTestCase's `newIndexSearcher()` instead.  Lucene's
version can randomly wrap with IndexReader with things we can't handle
like ParallelCompositeReader

Original commit: elastic/x-pack-elasticsearch@b4c0e9a601
This commit is contained in:
polyfractal 2018-03-02 17:07:57 -08:00
parent faac0d2a52
commit 933738c264
2 changed files with 5 additions and 5 deletions

View File

@ -896,7 +896,7 @@ public class RollupResponseTranslationTests extends AggregatorTestCase {
indexWriter.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
Aggregator aggregator = createAggregator(aggBuilder, indexSearcher, fieldType);
try {

View File

@ -77,7 +77,7 @@ public class IndexerUtilsTests extends AggregatorTestCase {
indexWriter.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
DateFieldMapper.Builder builder = new DateFieldMapper.Builder(timestampField);
DateFieldMapper.DateFieldType timestampFieldType = builder.fieldType();
@ -144,7 +144,7 @@ public class IndexerUtilsTests extends AggregatorTestCase {
indexWriter.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
DateFieldMapper.Builder builder = new DateFieldMapper.Builder(timestampField);
DateFieldMapper.DateFieldType timestampFieldType = builder.fieldType();
@ -216,7 +216,7 @@ public class IndexerUtilsTests extends AggregatorTestCase {
indexWriter.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
MappedFieldType valueFieldType = new NumberFieldMapper.NumberFieldType(NumberFieldMapper.NumberType.LONG);
valueFieldType.setName(valueField);
@ -281,7 +281,7 @@ public class IndexerUtilsTests extends AggregatorTestCase {
indexWriter.close();
IndexReader indexReader = DirectoryReader.open(directory);
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
DateFieldMapper.Builder builder = new DateFieldMapper.Builder(timestampField);
DateFieldMapper.DateFieldType timestampFieldType = builder.fieldType();