LUCENE-5666: fix bug (null is no longer allowed)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5666@1594316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-05-13 18:27:03 +00:00
parent 37d3efbc62
commit 85e4dc3300
1 changed files with 2 additions and 2 deletions

View File

@ -175,7 +175,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
private 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,SolrIn
public 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 factory
this(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,SolrIn
Directory dir = getIndexReader().directory();
this.reserveDirectory = reserveDirectory;
this.createdDirectory = r == null;
if (reserveDirectory) {
// keep the directory from being released while we use it
directoryFactory.incRef(dir);