Our Sitecore 9.3 platform has a custom index called "OurProject_crawledcontent" which is used by the search functionality on the main website. This index is rebuilt by a Sitecore task every morning, which starts a crawler that crawls the site and builds an index based on the HTML.
Since this is a custom index which doesn't ever have to be updated outside of the daily rebuild, it's configured to use the "manual" index update strategy.
We are using SolrCloud.
To make sure that the index won't be empty during the daily rebuild, we are using the SwitchOnRebuildSolrCloudSearchIndex type for this index (on CM). We are following the rules that are document here: https://doc.sitecore.com/xp/en/developers/91/platform-administration-and-architecture/switch-solr-indexes.html
This is not working correctly. While the daily rebuild task is busy, our search index is empty.
This is probaby caused by the fact that we're having trouble with this specific rule:
Only use the SwitchOnRebuildSolrCloudSearchIndex index type in combination with an active index update strategy (index has at least one index update strategy other than manual).
We are using a manual update strategy, so to comply with this rule, we also added a second update strategy as a dummy that should not do anything. It solely exists to comply wit the rule mentioned above. This second update strategy is of type IntervalAsynchronousStrategy with a very large interval and listening to the "core" database (because this database doesn't change often anyway).
These are the relevant parts of our configuration on the CM server:
<fakeIntervalAsync type="Sitecore.ContentSearch.Maintenance.Strategies.IntervalAsynchronousStrategy, Sitecore.ContentSearch">
<param desc="database">core</param>
<param desc="interval">99.00:00:00</param>
<CheckForThreshold>false</CheckForThreshold>
</fakeIntervalAsync>
<index id="OurProject_crawledcontent" type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrCloudSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="mainalias">OurProject_crawledcontent_main_alias</param>
<param desc="collection">OurProject_crawledcontent</param>
<param desc="rebuildalias">OurProject_crawledcontent_rebuild_alias</param>
<param desc="rebuildcollection">OurProject_crawledcontent_rebuild</param>
<param ref="contentSearch/indexConfigurations/databasePropertyStore" desc="propertyStore" param1="$(id)"/>
<configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration">
<documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
<indexAllFields>true</indexAllFields>
<include hint="list:AddIncludedTemplate"/>
<include hint="list:AddIncludedField"/>
<fields hint="raw:AddExcludedSpecialField"/>
<fields hint="raw:AddComputedIndexField"/>
</documentOptions>
</configuration>
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual"/>
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/fakeIntervalAsync"/>
</strategies>
<locations hint="list:AddCrawler">
<crawler type="OurProject.WebSearch.Crawlers.WebCrawler, OurProject.WebSearch">
</crawler>
</locations>
</index>
This is the code executed in our daily Sitecore task:
var index = Sitecore.ContentSearch.ContentSearchManager.GetIndex(indexName);
Sitecore.ContentSearch.Maintenance.IndexCustodian.FullRebuild(index);
This is a part of the code that we use on our website's search page, which yields 0 results during the rebuild process (and works perfectly otherwise):
using (var context = Sitecore.ContentSearch.ContentSearchManager.GetIndex(indexName).CreateSearchContext())
{
// var searchQuery = context.GetQueryable . . .
}
It's not working. While the index is being rebuilt by the daily task, the index seems to be empty, so the search page gives 0 results.
I have three questions:
Why does this rule even exist, that the SwitchOnRebuildSolrCloudSearchIndex type requires at least one non-manual index update strategy? What does an UPDATE strategy have to do with the REBUILD mechanism?
Given that this rule exists, am I correct in assuming that adding a dummy/fake update index strategy should work, simply because it makes us follow the rules, even though this update strategy itself doesn't do anything?
If the answer to question 2 is "yes", does anyone have an idea why it's not working in our case?