mirror of https://github.com/apache/lucene.git
SOLR-3531: Allowing configuring maxMergeSizeMB and maxCachedMB when using NRTCachingDirectoryFactory.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1417736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6098695cca
commit
af20e0b5a6
|
@ -109,6 +109,9 @@ New Features
|
|||
* SOLR-4114: Allow creating more than one shard per instance with the
|
||||
Collection API. (Per Steffensen, Mark Miller)
|
||||
|
||||
* SOLR-3531: Allowing configuring maxMergeSizeMB and maxCachedMB when
|
||||
using NRTCachingDirectoryFactory. (Andy Laird via Mark Miller)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -23,15 +23,32 @@ import java.io.IOException;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.store.NRTCachingDirectory;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
||||
/**
|
||||
* Factory to instantiate {@link org.apache.lucene.store.NRTCachingDirectory}
|
||||
*/
|
||||
public class NRTCachingDirectoryFactory extends StandardDirectoryFactory {
|
||||
private double maxMergeSizeMB;
|
||||
private double maxCachedMB;
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
SolrParams params = SolrParams.toSolrParams(args);
|
||||
maxMergeSizeMB = params.getDouble("maxMergeSizeMB", 4);
|
||||
if (maxMergeSizeMB <= 0){
|
||||
throw new IllegalArgumentException("maxMergeSizeMB must be greater than 0");
|
||||
}
|
||||
maxCachedMB = params.getDouble("maxCachedMB", 48);
|
||||
if (maxCachedMB <= 0){
|
||||
throw new IllegalArgumentException("maxCachedMB must be greater than 0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Directory create(String path) throws IOException {
|
||||
return new NRTCachingDirectory(FSDirectory.open(new File(path)), 4, 48);
|
||||
return new NRTCachingDirectory(FSDirectory.open(new File(path)), maxMergeSizeMB, maxCachedMB);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue