public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {IndexWriterConfig iwConf = new IndexWriterConfig(runData.getAnalyzer());iwConf.setOpenMode(mode);IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);iwConf.setIndexDeletionPolicy(indexDeletionPolicy);if (commit != null) {iwConf.setIndexCommit(commit);}final String mergeScheduler = config.get("merge.scheduler","org.apache.lucene.index.ConcurrentMergeScheduler");if (mergeScheduler.equals(NoMergeScheduler.class.getName())) {iwConf.setMergeScheduler(NoMergeScheduler.INSTANCE);} else {try {iwConf.setMergeScheduler(Class.forName(mergeScheduler).asSubclass(MergeScheduler.class).getConstructor().newInstance());} catch (Exception e) {}}}
public static IndexWriterConfig CreateWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit){LuceneVersion version = (LuceneVersion)Enum.Parse(typeof(LuceneVersion), config.Get("writer.version", LuceneVersion.LUCENE_48.ToString()));IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.Analyzer);iwConf.OpenMode = mode;IndexDeletionPolicy indexDeletionPolicy = GetIndexDeletionPolicy(config);iwConf.IndexDeletionPolicy = indexDeletionPolicy;if (commit != null)iwConf.IndexCommit = commit;string mergeScheduler = config.Get("merge.scheduler","Lucene.Net.Index.ConcurrentMergeScheduler, Lucene.Net");if (mergeScheduler.Contains(".ConcurrentMergeScheduler,")){mergeScheduler = "Lucene.Net.Index.TaskMergeScheduler, Lucene.Net";}Type mergeSchedulerType = Type.GetType(mergeScheduler);if (mergeSchedulerType == null){throw new Exception("Unrecognized merge scheduler type '" + mergeScheduler + "'");}else if (mergeSchedulerType.Equals(typeof(NoMergeScheduler))){iwConf.MergeScheduler = NoMergeScheduler.INSTANCE;}else{try{iwConf.MergeScheduler = (IMergeScheduler)Activator.CreateInstance(mergeSchedulerType);}catch (Exception e){}}}