/// <summary>
        /// Event used to maintain any detached 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;
            }
        }
Exemple #2
0
        /// <summary>
        /// Umbraco started
        /// </summary>
        /// <param name="umbracoApplication"></param>
        /// <param name="applicationContext"></param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var indexProviders = ExamineManager
                                 .Instance
                                 .IndexProviderCollection
                                 .Select(x => x as BaseUmbracoIndexer)    // UmbracoContentIndexer, UmbracoMemberIndexer
                                 .Where(x => x != null)
                                 .ToArray();

            if (!indexProviders.Any())
            {
                LogHelper.Warn(typeof(LookService), "Unable to find any Umbraco Examine indexers to hook into !");
            }
            else
            {
                var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);

                LookService.Initialize(umbracoHelper);

                foreach (var indexProvider in indexProviders)
                {
                    indexProvider.DocumentWriting += (sender, e) => this.Indexer_DocumentWriting(sender, e, umbracoHelper, indexProvider.Name);
                }
            }
        }
Exemple #3
0
        public static void AssemblyInitialize(TestContext testContext)
        {
            // always start with an empty index
            TestHelper.DeleteIndex();

            // Wire up the location indexers
            LookService.Initialize(null);
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="umbracoApplication"></param>
 /// <param name="applicationContext"></param>
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     LookService.Initialize(
         this.Indexer_GatheringNodeData,
         new UmbracoHelper(UmbracoContext.Current));
 }