Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rebuild Examine Indexes on Application Start
using System.Collections.Generic;
using Examine;
using umbraco.businesslogic;
namespace MyApplication
{
public class ExamineIndexRebuild : ApplicationStartupHandler
{
public ExamineIndexRebuild()
{
// Rebuild selected indexes
var indexes = new List<string> { "CategorySiteContentIndexer", "SiteContentIndexer", "ExternalIndexer" };
indexes.ForEach(index => ExamineManager.Instance.IndexProviderCollection[index].RebuildIndex());
// Or rebuild them all
// ExamineManager.Instance.IndexProviderCollection.ToList().ForEach(index => index.RebuildIndex());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment