Solr spellcheck works only if you are using the eContent data provider.
Step 1: Configure Solr core¶
Make sure your Solr core is configured correctly. Restart Solr if you did any changes.
Look for the
solrconfig.xml file inside your Solr core directory:
Add the following lines to the
1 2 3 4
Make sure you have also the following element in the XML file:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
Additional definitions for spellcheck can be configured here, but spellcheck should also work with the default values.
Go to your root directory and execute the following commands:
Step 2: Enable spellcheck in configuration¶
Step 3: Define search controller behavior¶
The search engine returns search collation and search term suggestions.
1 2 3 4 5 6 7 8
||(string) The collation text. This is the suggested phrase (should contain the complete phrase if the user searched for more than one term.For example, if user searches for "blac spealer", the collation could be: "black speaker"Collation has text only if it results are not 0.|
||The number of hits of collation search.|
||An array of suggested words and their hits.Example:
Step 4: Prepare template¶
The following Twig template displays these results:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17