When rebuilding indexes on a content delivery server, any components that search that index fail (blow up). How can I rebuild my index without causing the search components to be unavailable? Furthermore, is there a standard way to handle this?
The code I'm using to perform the reindex on regular intervals:
Sitecore.Data.Database db = Sitecore.Configuration.Factory.GetDatabase(DBName);
Index index = db.Indexes[IndexName];
index.GetSearcher(db).Close();
index.Rebuild(db);
To give a little context:
- Sitecore version - 6.4.1 (rev. 110324)
- It is necessary to rebuild the index because it contains some data from Sitecore and some data from an external system.
As Mark Ursino advices in the post How to maintain Sitecore Lucene indexes in huge content delivery webfarm:
You can consider using the open source Sitecore Lucene Refresher that will run a index crawl operation in-memory and will commit the index back to the file system so you don't lose any index content during the rebuild process.
来源:https://stackoverflow.com/questions/17949967/how-to-maintain-lucene-index-availability-during-rebuild