Running a spell check query using PHP
Let us configure Solr so that spell check happens on two fields, name and author:
Change the contents of the
schema.xml
file. Create a new field on which spellcheck will happen and copy thename
andauthor
fields to the new field using the following code:<field name="spellfld" type="text_general" indexed="true" stored="false" multiValued="true"/> <copyField source="name" dest="spellfld"/> <copyField source="author" dest="spellfld"/>
Change the spellchecker field for the default spellchecker in
solrconfig.xml
to the new field we have just created. The default spellchecker uses theDirectSolrSpellChecker
implementation of spell checker available with Solr.<lst name="spellchecker"> <str name="name">default</str> <str name="field">spellfld</str>
By default the
/select
request handler in Solr configuration does not have spellcheck settings and results. So let us add these variables inrequestHandler
named/select...