From ec60018e34865041d113e8a24e9c024f3378ae9a Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 13 Oct 2015 21:06:20 +0200 Subject: [PATCH] add comment why and when we have a leaf reader in the warmer --- .../java/org/elasticsearch/index/engine/InternalEngine.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java b/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java index a55fa0ce660..75bcdfa552e 100644 --- a/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java +++ b/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java @@ -952,6 +952,9 @@ public class InternalEngine extends Engine { public IndexSearcher newSearcher(IndexReader reader, IndexReader previousReader) throws IOException { IndexSearcher searcher = super.newSearcher(reader, previousReader); if (reader instanceof LeafReader && isMergedSegment((LeafReader)reader)) { + // we call newSearcher from the IndexReaderWarmer which warms segments during merging + // in that case the reader is a LeafReader and all we need to do is to build a new Searcher + // and return it since it does it's own warming for that particular reader. return searcher; } if (warmer != null) {