public void Initialize() { if (!SolrContentSearchManager.IsEnabled) { throw new InvalidOperationException("Solr configuration is not enabled. Please check your settings and include files."); } _operations = new DefaultSolrLocator<Dictionary<string, object>>(); // Override the document serializer to support boosting. _operations.DocumentSerializer = new SolrFieldBoostingDictionarySerializer(_operations.FieldSerializer); foreach (var index in SolrContentSearchManager.Cores) { AddCore(index, typeof(Dictionary<string, object>), $"{SolrContentSearchManager.ServiceAddress}/{index}"); } if (SolrContentSearchManager.EnableHttpCache) { _operations.HttpCache = new HttpRuntimeCache(); } _operations.RegisterCores(); _operations.CoreAdmin = BuildCoreAdmin(); //Register the service locator (yes, its a horrible pattern but this means we dont have to change anything internally in Sitecore for now). Microsoft.Practices.ServiceLocation.ServiceLocator.SetLocatorProvider(() => new DefaultServiceLocator<Dictionary<string, object>>(_operations)); SolrContentSearchManager.SolrAdmin = _operations.CoreAdmin; SolrContentSearchManager.Initialize(); }
public SharedSolrStartUp(SharedServiceLocator sharedServiceLocator) { if (SolrContentSearchManager.EnableHttpCache) { solrCache = new HttpRuntimeCache(); } operations = new DefaultSolrLocator <Dictionary <string, object> >(); _sharedServiceLocator = sharedServiceLocator; }