How to get Solr Suggestester to return spelling suggestions

I am currently integrating Apache Solr search into my platform and using Suggestester's autocomplete functionality. However, the Suggestester module also does not return spelling suggestions, therefore, for example, if I look for:

shi 

The helper module returns, among others, the following:

 shirt shirts 

However, if I search:

 shrt 

No offers are returned. I'd like to know:

a) The incorrect configuration of the Guidester module that led to this? b) Is the pointer module built-in in such a way that it does not return spelling sentences? c) How can I get the Suggestester module to return spelling suggestions and also not make a second request for spelling corrections?

I read the Solr documentation, but didn't seem to be able to achieve this.

+7
source share
1 answer

You need to configure the spellchecker component to generate alternative spelling options, as described at http://wiki.apache.org/solr/SpellCheckComponent

The task consists of the following steps: - Refresh schema.xml to suggest spelling, for example, you can copy fields to a new field, for example, "spelling", for example,

 <copyField source="id" dest="spelling" /> <copyField source="name" dest="spelling" /> <copyField source="description" dest="spelling" /> <copyField source="longdescription" dest="spelling" /> <copyField source="category" dest="spelling" /> <copyField source="source" dest="spelling" /> <copyField source="merchant" dest="spelling" /> <copyField source="contact" dest="spelling" /> 
  • Update solrconfig.xml file

<requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int> <str name="df">defaultSearchField</str> <!-- spell check component configuration --> <str name="spellcheck">true</str> <str name="spellcheck.count">5</str> <str name="spellcheck.collate">true</str> <str name="spellcheck.maxCollationTries">5</str> </lst> <!-- add spell check processing after the default search component as configured above completed it task --> <arr name="last-components"> <str>spellcheck</str> </arr> </requestHandler>

<searchComponent name="spellcheck" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <!-- decide between dictionary based vs index based spelling suggestion, in most cases it makes sense to use index based spell checker as it only generates terms which are actually present in your search corpus --> <str name="classname">solr.IndexBasedSpellChecker</str> <!-- field to use --> <str name="field">spelling</str> <!-- buildOnCommit|buildOnOptimize --> <str name="buildOnCommit">true</str> <!-- $solr.solr.home/data/spellchecker--> <str name="spellcheckIndexDir">./spellchecker</str> <str name="accuracy">0.7</str> <float name="thresholdTokenFrequency">.0001</float> </lst> </searchComponent>

  • Retell the case

  • Testing recommendations, for example,

    Http: //: / Solr / select / d = coachin

    response { "responseHeader":{ "status":0, "QTime":12, "params":{ "indent":"true", "q":"coachin"}}, "response":{"numFound":0,"start":0,"docs":[] }, "spellcheck":{ "suggestions":[ "coachin",{ "numFound":1, "startOffset":0, "endOffset":7, "suggestion":["cochin"]}]}}

Hope this helps.

+7
source

All Articles