/// <summary> /// Wire-up events to maintain Look indexes 'as and when' Umbraco data changes /// </summary> /// <param name="umbracoApplication"></param> /// <param name="applicationContext"></param> protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { // set once, as they will be configured in the config this._lookIndexers = ExamineManager .Instance .IndexProviderCollection .Select(x => x as LookIndexer) .Where(x => x != null) .ToArray(); if (this._lookIndexers.Any()) { this._umbracoHelper = new UmbracoHelper(UmbracoContext.Current); LookService.Initialize(this._umbracoHelper); ContentService.Published += ContentService_Published; MediaService.Saved += this.MediaService_Saved; MemberService.Saved += this.MemberService_Saved; ContentService.UnPublished += ContentService_UnPublished; MediaService.Deleted += this.MediaService_Deleted; MemberService.Deleted += this.MemberService_Deleted; } }
/// <summary> /// Umbraco started /// </summary> /// <param name="umbracoApplication"></param> /// <param name="applicationContext"></param> protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { LookService.Initialize(new UmbracoHelper(UmbracoContext.Current)); // if consumer hasn't (yet) set the examine indexers, then register them all (the consumer can always change them again) if (!LookService.ExamineIndexersConfigured) { // register all LookService.SetExamineIndexers(); } }