The project I’m working on makes fairly extensive use of Sitecore’s search functionality, and I realised that one problem I could foresee was that of Index updates. When rebuilding the search index, by default Sitecore deletes the existing index, and then builds a new one. While this is going on, search is not available. That’s not really acceptable…
Well, it turns out that there is an alternative; Sitecore can build the new index in a different folder, and then swap them over. This means that there is no downtime. I found this (courtesy of a colleague) on this page – Hot Swappable Indexes with Sitecore 7.
Neat! But wouldn’t it be good to do this for many instances? And without having to edit all those web.config files? Shouldn’t we be patching them? Well, yes…
<?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <contentSearch> <configuration> <indexes> <index id="sitecore_master_index"> <patch:attribute name="type">Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex, Sitecore.ContentSearch.LuceneProvider</patch:attribute> </index> <index id="sitecore_web_index"> <patch:attribute name="type">Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex, Sitecore.ContentSearch.LuceneProvider</patch:attribute> </index> <index id="sitecore_core_index"> <patch:attribute name="type">Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex, Sitecore.ContentSearch.LuceneProvider</patch:attribute> </index> </indexes> </configuration> </contentSearch> </sitecore> </configuration>
That should do it. Now just combine this with my previous tip about Patch Include orders and you should be done.