lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Solr Wiki] Update of "SpellCheckComponent" by GrantIngersoll
Date Wed, 18 Aug 2010 15:35:26 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "SpellCheckComponent" page has been changed by GrantIngersoll.


   * org.apache.solr.spelling.IndexBasedSpellChecker -- Create and use a spelling dictionary
that is based on the Solr index or an existing Lucene index
   * org.apache.solr.spelling.FileBasedSpellChecker -- Create and use a spelling dictionary
based off a flat file.  This can be useful for using Solr as a spelling server or in other
instances when spelling suggestions do not need to be based on the content of an actual index.
+ == Custom Comparators and the Lucene Spell Checkers (!IndexBasedSpellChecker, !FileBasedSpellChecker)
+ <!> [[Solr3.1]] [[Solr4.0]]
+ By default, the Lucene Spell checkers sort suggestions first by the score from the string
distance calculation and second by the frequency (if available) of the suggestion in the index.
 Applications may wish to change this to better fit their scoring needs.  This can be done
when configuring the Lucene spell checker by adding the comparatorClass option to the configuration.
 This is a string value which may be one of the following:
+  * Empty -- in which case the default is used.
+  * score -- explicitly choose the default case
+  * freq -- Sort by frequency first, then score.
+  * A fully qualified class name -- Provide a custom comparator that implements Comparator<SuggestWord>.
+ See !SuggestWordScoreComparator in the contrib/spellchecker code base of Lucene for an example.
+ An example configuration might look like:
+ {{{
+     <lst name="spellchecker">
+       <str name="name">freq</str>
+       <str name="field">lowerfilt</str>
+       <str name="spellcheckIndexDir">spellcheckerFreq</str>
+       <!-- comparatorClass be one of:
+         1. score (default)
+         2. freq (Frequency first, then score)
+         3. A fully qualified class name
+        -->
+       <str name="comparatorClass">freq</str>
+       <str name="buildOnCommit">true</str>
+     </lst>
+ }}}
  == Building on Commits ==
  SpellCheckComponent can be configured to automatically (re)build indices based on fields
in Solr index when a commit is done. In order to do so you must enable this feature by adding
the following line in your SpellCheckComponent configuration for each spellchecker where you
wish it to apply:

View raw message