One great way to improve the search experience on a website is to suggest alternate/corrected queries if the original ones were misspelled, similar to the “Did you mean …” provided by Google. If you are interested to implement this feature, I’ve some good news and some bad news for you. The good news is, this feature can be effortlessly implmeneted using the Solr Spellcheck search component. The bad news is, unfortunately the Spellcheck search component is not supported yet by the Sitecore 7/Solr search provider.
This article will show you an easy way to extend the search provider – using extension methods – to implement the Spellcheck feature. Two main steps are needed here; configure Solr to enable the Spellcheck component, and write the extension methods.
1. Enabling the Spellchecker in Solr
Edit your solrconfig.xml and locate the following element:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
Under the searchComponent element, configure the field that will be used for building the suggested search queries. It should look like: