Skip to content

Instantly share code, notes, and snippets.

@kevinblake
Created November 2, 2012 11:50
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kevinblake/4000628 to your computer and use it in GitHub Desktop.
Save kevinblake/4000628 to your computer and use it in GitHub Desktop.
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