Checking In and Publishing Page removes page from index? (Kentico 11)

Austin Perez asked on September 7, 2018 20:37

Whenever a person "Check Out" a page on our Kentico site, then "Check In" and "Publish" that page, that page gets removed from the index. I have to completely rebuild the index in order to have the page re-appear.

We have a scheduled task that rebuilds the index every night, but if someone makes edits in the morning, we have to manually rebuild index or wait. Is there a way to prevent a page from being removed from the index when Checking it out? Or, is there a way to rebuild index when any item is checked-in/published?

Correct Answer

Zach Perry answered on September 7, 2018 20:48

Is it a custom index?

If so, you can trigger a rebuild on the publish event.

Code to trigger a rebuild:

  SearchIndexInfo indexToRebuild = SearchIndexInfoProvider.GetSearchIndexInfo(index);
            if (indexToRebuild != null)
            {
                // Creates a rebuild task for the index.
                // The rebuild task will be processed as part of the next request handled by the application,
                // or by a scheduled task if the application is configured to handle search tasks using the scheduler.
                SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Rebuild, null, null, indexToRebuild.IndexName, indexToRebuild.IndexID);
            }
1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.