The FileBasedSpellChecker evaluates spellings from an external file dictionary. This is useful when Solr works as a spellchecking server. This is also useful where spelling suggestions are not on the base of actual terms. To implement FileBasedSpellChecker, modify solrconfig.xml as follows:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="classname">solr.FileBasedSpellChecker</str>
<str name="name">file</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="spellcheckIndexDir">./spellcheckerFile</str>
<!-- optional elements with defaults
<str name="distanceMeasure">org.apache.lucene.search.spell.LevensteinDistance</str>
<str name="accuracy">0.5</str>
-->
</lst>
</searchComponent>
The sourceLocation parameter holds the path of the file that contains the spelling dictionary. The characterEncoding parameter specifies the character-encoding algorithm.