A "Did you mean?" feature can be implemented via the Solr spellcheck handler. To get good results, the field for spell checking should have specialized indexing behavior. Typically, special for the requested locale.
By default, Solr is configured to have the fields de_spell
and en_spell
to support spellchecking in German and English. Each of this fields has special type spell_de
vs. spell_en
and we have configured a spellchecker de
and a spellchecker en
, using each one of the field.
The fields are filled with the localized extracted content of a file and the title property's value. And only for contents in sites or in the shared folder the spell fields are filled.
To get further locales supported, configure similarly:
- A field type
spell_{locale}
- A field
{locale}_spell
of type spell_{locale}
- A spellcheck component
{locale}
(in the solrconfig.xml
, in the same folder as the schema.xml
).
To use the spellchecker, you can query it as follows (example for the Solr handler, log in before you use it and remove the comments starting with //
):