Sitecore Search Performance: Tune-up Sitecore’s Search Indexes
Learn a couple of easy to apply tips on how to tune-up your existing search indexes.
The FFW team works with more than just Drupal and WordPress. We've built some award-winning Sitecore solutions as well, and in this Sitecore blog series, we'll be sharing our insights on refining Sitecore's search functionality to enhance the user experience.
In this blog post, I’ll share a couple of easy to apply tips on how to tune-up your existing search indexes. Before applying the following tips, I recommend first to investigate each topic a bit deeper and think about how these improvements would fit in your scenario.
Configure index optimization for all indexes
Sitecore comes with an agent to optimize search indexes. The default configuration has sitecore_master_index optimized at periodic intervals. You could add all other indexes in your solution to this agent so all indexes are periodically optimized. The agent is defined in the Sitecore.ContentSearch.config and here is the right place where to add the other indexes:
Index only required content locations
You can configure your index crawlers to include only the portion that it needs to crawl and index.
It is done by adding crawlers within the <locations> element in your index configuration. For example:
<agent type="Sitecore.ContentSearch.Tasks.Optimize" method="Run" interval="01:00:00">
<!-- Add other indexes here -->
Please, keep in mind that you must not edit the Sitecore configs directly but use a patch file to apply your changes.
Use the right index update strategies
You use index update strategies to maintain indexes. You can configure each index with a unique set of index update strategies. Use index update strategies that are appropriate for the database. As a rule of thumbs you could use the following:
- Core – intervalAsyncCore which by default updates the index every minute
- Master – syncMaster (default) or intervalAsyncMaster. In environments where you have a high volume of content authoring, intervalAsyncMaster with a 1-minute interval will cause a lower load on the machine than syncMaster. Obviously, this would mean that your content changes will not be available through a search for the time interval (1 minute) you have specified.
- Publishing target (web) – onPublishEndAsync which updates the index after a publish
If you want to learn more about the index update strategies, check out the official Sitecore documentation.
Optimize computed fields implementations
Computed fields allow you to add entirely new fields in your search indexes, in addition to those of Sitecore. This is a great way of storing calculated information while Sitecore indexes your items as opposed to using more resource to calculate it on the fly for use in your sublayouts/layouts. Using computed fields also reflects on indexing performance. That’s why you should always ensure that your computed fields implementations are optimized. Avoid having expensive code like DB calls or API calls that can slow down your indexing. If there is a need for DB or API calls, consider pre-fetching this data and having it in an in-memory cache, which can then be used by your computed indexes. Also handle any exceptions gracefully in your computed indexes.
Want to learn more about improving your indexing in Sitecore? Here are a few resources and further reading coming from the great Sitecore community that I'd recommend:
If you enjoyed this blog post, please don’t forget to check the Sitecore Search Series: Your Complete Guide to Performance Improvement blog series for more good tips!
If you need help with a Sitecore site, let us know. And if you have more Sitecore Search Performance tips, feel free to put them as comments below.