mirror of https://github.com/apache/lucene.git
SOLR-3322 Add more context to IndexReaderFactory.newReader.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1311812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb97a9e169
commit
aff9334337
|
@ -484,6 +484,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-3302: Upgraded SLF4j to version 1.6.4 (hossman)
|
* SOLR-3302: Upgraded SLF4j to version 1.6.4 (hossman)
|
||||||
|
|
||||||
|
* SOLR-3322: Add more context to IndexReaderFactory.newReader (ab)
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,13 @@ public abstract class IndexReaderFactory implements NamedListInitializedPlugin {
|
||||||
* Creates a new IndexReader instance using the given Directory.
|
* Creates a new IndexReader instance using the given Directory.
|
||||||
*
|
*
|
||||||
* @param indexDir indexDir index location
|
* @param indexDir indexDir index location
|
||||||
|
* @param core {@link SolrCore} instance where this reader will be used. NOTE:
|
||||||
|
* this SolrCore instance may not be fully configured yet, but basic things like
|
||||||
|
* {@link SolrCore#getCoreDescriptor()}, {@link SolrCore#getSchema()} and
|
||||||
|
* {@link SolrCore#getSolrConfig()} are valid.
|
||||||
* @return An IndexReader instance
|
* @return An IndexReader instance
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public abstract DirectoryReader newReader(Directory indexDir)
|
public abstract DirectoryReader newReader(Directory indexDir, SolrCore core)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.store.Directory;
|
||||||
public class StandardIndexReaderFactory extends IndexReaderFactory {
|
public class StandardIndexReaderFactory extends IndexReaderFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DirectoryReader newReader(Directory indexDir) throws IOException {
|
public DirectoryReader newReader(Directory indexDir, SolrCore core) throws IOException {
|
||||||
return DirectoryReader.open(indexDir, termInfosIndexDivisor);
|
return DirectoryReader.open(indexDir, termInfosIndexDivisor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,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 {
|
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
|
// we don't need to reserve the directory because we get it from the factory
|
||||||
this(core, schema,name, core.getIndexReaderFactory().newReader(directoryFactory.get(path, config.lockType)), true, enableCache, false, directoryFactory);
|
this(core, schema,name, core.getIndexReaderFactory().newReader(directoryFactory.get(path, config.lockType), core), true, enableCache, false, directoryFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory) throws IOException {
|
public SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory) throws IOException {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class AlternateDirectoryTest extends SolrTestCaseJ4 {
|
||||||
static volatile boolean newReaderCalled = false;
|
static volatile boolean newReaderCalled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DirectoryReader newReader(Directory indexDir) throws IOException {
|
public DirectoryReader newReader(Directory indexDir, SolrCore core) throws IOException {
|
||||||
TestIndexReaderFactory.newReaderCalled = true;
|
TestIndexReaderFactory.newReaderCalled = true;
|
||||||
return DirectoryReader.open(indexDir);
|
return DirectoryReader.open(indexDir);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue