Apache Solr open-source search software
LUCENE-5666: fix bug (null is no longer allowed)
Robert Muir85e4dc3300d1
diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.javaindex cd5d04bba7e..4d9ab47d456 100644--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java@@ -175,7 +175,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrInprivate String path;private final boolean reserveDirectory;- private final boolean createdDirectory;+ private boolean createdDirectory;private static DirectoryReader getReader(SolrCore core, SolrIndexConfig config, DirectoryFactory directoryFactory, String path) throws IOException {DirectoryReader reader = null;@@ -200,6 +200,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrInpublic SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, boolean enableCache, DirectoryFactory directoryFactory) throws IOException {// we don't need to reserve the directory because we get it from the factorythis(core, path, schema, config, name, getReader(core, config, directoryFactory, path), true, enableCache, false, directoryFactory);+ this.createdDirectory = true;}public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory) throws IOException {@@ -224,7 +225,6 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrInDirectory dir = getIndexReader().directory();this.reserveDirectory = reserveDirectory;- this.createdDirectory = r == null;if (reserveDirectory) {// keep the directory from being released while we use itdirectoryFactory.incRef(dir);