Process solrconfig.xml Spellchecker request

I am trying to configure spellchecker according to the solr documentation . But when I test, I have no suggestions. The following is a snippet of code:

<searchComponent name="spellcheck" class="solr.SpellCheckComponent"> <str name="queryAnalyzerFieldType">textSpell</str> <lst name="spellchecker"> <str name="classname">solr.IndexBasedSpellChecker</str> <str name="name">default</str> <str name="field">name</str> <str name="spellcheckIndexDir">./spellchecker</str> </lst> <str name="queryAnalyzerFieldType">textSpell</str> </searchComponent> <requestHandler name="/spellcheck" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <!-- Optional, must match spell checker name as defined above, defaults to "default" --> <str name="spellcheck.dictionary">default</str> <!-- omp = Only More Popular --> <str name="spellcheck.onlyMorePopular">false</str> <!-- exr = Extended Results --> <str name="spellcheck.extendedResults">false</str> <!-- The number of suggestions to return --> <str name="spellcheck.count">1</str> </lst> <arr name="last-components"> <str>spellcheck</str> </arr> </requestHandler> 

The request that I send to Solr:
d =% 2B% 28text% 3A% 28gasal% 29% 29 & suggestField = contentOriginal & ontologySeed = gasal & spellcheck.build = true & spellcheck.q = gasal & spellcheck = true & spellcheck.collate = true & hl = true & chap. snippets = 5 & hl.fl = text & hl.fl = text & lines = 12 & start = 0 & quarts =% 2Fsuggestprobabilistic

Does anyone know why? thanks in advance

+6
solr spell-checking
source share
1 answer

First, do not repeat queryAnalyzerFieldType twice in the component configuration.

It is recommended that you do not use the /spellcheck handler, but instead bind the /spellcheck component to standard request handlers (or eliminate if this is what you are using) as follows:

 <requestHandler name="standard" class="solr.SearchHandler" default="true"> <lst name="defaults"> ... </lst> <arr name="last-components"> <str>spellcheck</str> ... </arr> </requestHandler> 

Then you can call it like this:
http://localhost:8983/solr/select?q=komputer&spellcheck=true

Also remember to create a spellcheck dictionary before using it:
http://localhost:8983/solr/select/?q=*:*&spellcheck=true&spellcheck.build=true

You can force the dictionary to build at each commit by setting it in the component:

 <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> <str name="queryAnalyzerFieldType">textSpell</str> <lst name="spellchecker"> <str name="classname">solr.IndexBasedSpellChecker</str> <str name="name">default</str> <str name="field">name</str> <str name="spellcheckIndexDir">./spellchecker1</str> <str name="buildOnCommit">true</str> </lst> </searchComponent> 

Finally, make sure that the name field is indeed an indexed field of type textSpell and contains enough content to create a good dictionary. In my case, I have a field called spellchecker that is populated from several fields of my index (using copyField instructions in the schema).

+17
source share

All Articles