Anders G. Nordby

Lead Consultant at Itera

Tag Archives: EPiServer Find

EPiServer Find not Indexing on Save/Publish

For some reason, in my current project, EPiServer Find did not trigger on the save and publish events. I thought this should be out-of-the-box, but there might be other stuff happening that blocks this functionality. To solve the problem, I handle Find-indexing during my event handlers:

        internal static void PublishingContent(object sender, ContentEventArgs e)
        {
            // ...more stuff going on here...

            HandleFindIndexing(e.Content);
        }

        internal static void SavingContent(object sender, ContentEventArgs e)
        {
            // ...more stuff going on here...

            HandleFindIndexing(e.Content);
        }

        private static void HandleFindIndexing(IContent content)
        {
            bool shouldIndex;
            var ok = ContentIndexer.Instance.TryShouldIndex(content, out shouldIndex);
            if (ok && shouldIndex)
                ContentIndexer.Instance.Index(content);

            if (!shouldIndex)
                ContentIndexer.Instance.Delete(content);
        }
Advertisements