lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "SpellCheckComponent" by YonikSeeley
Date Wed, 21 Oct 2009 21:29:08 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 YonikSeeley.
The comment on this change is: add a quickstart section... no reason to make people wade through
config when it's in our example server..
http://wiki.apache.org/solr/SpellCheckComponent?action=diff&rev1=37&rev2=38

--------------------------------------------------

  
  The SpellCheckComponent can use the [[http://wiki.apache.org/jakarta-lucene/SpellChecker|Lucene
SpellChecker]] to give suggestion for given words, or one can implement their own spell checker
using the SolrSpellChecker abstract base class.
  
- See also SpellCheckerRequestHandler for an alternate, older piece of code to do spell checking.
+ = Quick Start =
+ The example server is configured with a request handler that uses the SpellCheckComponent.
+ If you haven't already, start the example server and index the example data as shown in
the [[http://lucene.apache.org/solr/tutorial.html|solr tutorial]].
+ 
+ Now send a spellcheck request.
+ Note the '''spellcheck.build=true''' which is needed only once to build the spellcheck index
from the main Solr index. It takes time and should '''not''' be specified with each request.
+ 
+ {{{
+ http://localhost:8983/solr/spell?q=hell ultrashar&spellcheck=true&spellcheck.collate=true&spellcheck.build=true
+ }}}
+ 
+ The response contains words not found in the index, along with alternatives.  The '''spellcheck.collate=true'''
causes a modified version of the original query to be returned with the most likely alternatives.
+ 
+ {{{
+ <lst name="spellcheck">
+  <lst name="suggestions">
+   <lst name="hell">
+ 	<int name="numFound">1</int>
+ 	<int name="startOffset">0</int>
+ 	<int name="endOffset">4</int>
+ 	<arr name="suggestion">
+ 	 <str>dell</str>
+ 	</arr>
+   </lst>
+   <lst name="ultrashar">
+ 	<int name="numFound">1</int>
+ 	<int name="startOffset">5</int>
+ 	<int name="endOffset">14</int>
+ 	<arr name="suggestion">
+ 	 <str>ultrasharp</str>
+ 	</arr>
+   </lst>
+   <str name="collation">dell ultrasharp</str>
+  </lst>
+ </lst>
+ }}}
  
  <<Anchor(configuration)>>
  = Configuration =
- The first step to use SpellCheckComponent is to specify the source of words which should
be used for suggestions in [[http://wiki.apache.org/solr/SolrConfigXml|solrconfig.xml]]. The
words can be loaded from a field in Solr, text files or even from fields in arbitary Lucene
indices. A sample configuration for loading words from a field in Solr looks like the following:
+ The first step to configure the SpellCheckComponent is to specify the source of words which
should be used for suggestions in [[http://wiki.apache.org/solr/SolrConfigXml|solrconfig.xml]].
The words can be loaded from a field in Solr, text files or even from fields in arbitary Lucene
indices. A sample configuration for loading words from a field in Solr looks like the following:
  <<Anchor(solrFieldSpellChecker)>>
  {{{
  <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
@@ -150, +185 @@

  
  The Solr example (in solr/example) comes with a preconfigured SearchComponent and an associated
RequestHandler for demonstration purposes.  See the example solrconfig.xml (solr/example/solr/conf/solrconfig.xml)
for setup parameters.
  
- == Simple results ==
+ == Example Requests ==
  
  A simple result using the spellcheck.q parameter. Note the spellcheck.build=true which is
needed only once to build the index. It should not be specified with for each request.
  

Mime
View raw message