Created
November 2, 2012 11:50
-
-
Save kevinblake/4000628 to your computer and use it in GitHub Desktop.
Rebuild Examine Indexes on Application Start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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