public override void Initialize(string name, NameValueCollection config) { if (config["dataService"] != null && !string.IsNullOrEmpty(config["dataService"])) { ////this should be a fully qualified type var serviceType = Type.GetType(config["dataService"]); DataService = (IDataService)Activator.CreateInstance(serviceType); } else if (DataService == null) { ////By default, we will be using the MerchelloDataService ////generally this would only need to be set differently for unit testing DataService = new MerchelloDataService(); } DataService.LogService.ProviderName = name; EnableDefaultEventHandler = true; ////set to true by default bool enabled; if (bool.TryParse(config["enableDefaultEventHandler"], out enabled)) { EnableDefaultEventHandler = enabled; } DataService.LogService.AddVerboseLog(-1, string.Format("{0} indexer initializing", name)); base.Initialize(name, config); if (config["useTempStorage"] != null) { var fsDir = base.GetLuceneDirectory() as FSDirectory; if (fsDir != null) { //Use the temp storage directory which will store the index in the local/codegen folder, this is useful // for websites that are running from a remove file server and file IO latency becomes an issue var attemptUseTempStorage = config["useTempStorage"].TryConvertTo<LocalStorageType>(); if (attemptUseTempStorage) { var indexSet = IndexSets.Instance.Sets[IndexSetName]; var configuredPath = indexSet.IndexPath; _localTempStorageIndexer.Initialize(config, configuredPath, fsDir, IndexingAnalyzer, attemptUseTempStorage.Result); } } } }
public override void Initialize(string name, NameValueCollection config) { if (config["dataService"] != null && !string.IsNullOrEmpty(config["dataService"])) { //this should be a fully qualified type var serviceType = Type.GetType(config["dataService"]); DataService = (IDataService)Activator.CreateInstance(serviceType); } else if (DataService == null) { //By default, we will be using the UmbracoDataService //generally this would only need to be set differently for unit testing DataService = new MerchelloDataService(); } DataService.LogService.ProviderName = name; EnableDefaultEventHandler = true; //set to true by default bool enabled; if (bool.TryParse(config["enableDefaultEventHandler"], out enabled)) { EnableDefaultEventHandler = enabled; } DataService.LogService.AddVerboseLog(-1, string.Format("{0} indexer initializing", name)); base.Initialize(name, config); }