Permalink
Browse files

fix ZOIE-103

  • Loading branch information...
javasoze committed Jan 5, 2012
1 parent 15af3f3 commit faedcdb580e6a16e8270f48ce2658f62435bd4e7
Showing with 24 additions and 2 deletions.
  1. +24 −2 zoie-solr/src/main/java/proj/zoie/solr/ZoieSystemHome.java
@@ -19,6 +19,10 @@
import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
+
+import proj.zoie.api.DirectoryManager;
+import proj.zoie.api.DirectoryManager.DIRECTORY_MODE;
+import proj.zoie.api.DefaultDirectoryManager;
import proj.zoie.api.Zoie;
import proj.zoie.api.ZoieException;
import proj.zoie.hourglass.impl.HourGlassScheduler;
@@ -98,10 +102,28 @@ else if (ZOIE_TYPE_HOURGLASS.equals(type)){
log.info("zoie similarity: "+similarity.getClass());
log.info("zoie analyzer: "+analyzer.getClass());
+ DIRECTORY_MODE dirMode;
+ String modeValue = config.get("zoie.directory.mode", "SIMPLE");
+ if ("SIMPLE".equals(modeValue)){
+ dirMode = DIRECTORY_MODE.SIMPLE;
+ }
+ else if ("NIO".equals(modeValue)){
+ dirMode = DIRECTORY_MODE.NIO;
+ }
+ else if ("MMAP".equals(modeValue)){
+ dirMode = DIRECTORY_MODE.MMAP;
+ }
+ else{
+ log.error("directory mode "+modeValue+" is not supported, SIMPLE is used.");
+ dirMode = DIRECTORY_MODE.SIMPLE;
+ }
+
+
StandardMBean mbean = null;
if (isTypeZoie){
- ZoieSystem<IndexReader,DocumentWithID> zoieSystem = new ZoieSystem<IndexReader,DocumentWithID>(idxFile,new ZoieSolrIndexableInterpreter(),new DefaultIndexReaderDecorator(),zoieConfig);
+ DirectoryManager dirMgr = new DefaultDirectoryManager(idxFile, dirMode);
+ ZoieSystem<IndexReader,DocumentWithID> zoieSystem = new ZoieSystem<IndexReader,DocumentWithID>(dirMgr,new ZoieSolrIndexableInterpreter(),new DefaultIndexReaderDecorator(),zoieConfig);
try {
mbean = new StandardMBean(zoieSystem.getAdminMBean(), ZoieSystemAdminMBean.class);
} catch (NotCompliantMBeanException e) {
@@ -128,7 +150,7 @@ else if ("hour".equals(freqString)){
throw new IllegalArgumentException("Unsupported frequency: "+freqString);
}
HourGlassScheduler scheduler = new HourGlassScheduler(freq,schedule,trimThreshold);
- HourglassDirectoryManagerFactory dirMgrFactory = new HourglassDirectoryManagerFactory(idxFile,scheduler);
+ HourglassDirectoryManagerFactory dirMgrFactory = new HourglassDirectoryManagerFactory(idxFile,scheduler,dirMode);
Hourglass<IndexReader,DocumentWithID> zoieSystem = new Hourglass<IndexReader, DocumentWithID>(dirMgrFactory, new ZoieSolrIndexableInterpreter(),new DefaultIndexReaderDecorator(), zoieConfig);
try {

0 comments on commit faedcdb

Please sign in to comment.