Solr spellchecker returns no results

I am working on an application that requires me to use Solr for the first time. I set it up, indexed the correct data, and queried as I would like, but I cannot get the spellchecker component to work properly. No matter what I request, spell checking will not return any suggestions. I have included the relevant parts of my solrconfig and schema.xml.

schema.xml

<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true"> <analyzer type="index"> <charFilter class="solr.HTMLStripCharFilterFactory"/> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StandardFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.StandardFilterFactory"/> </analyzer> </fieldType> <!-- CUT --> <field name="spell" type="textSpell" indexed="true" stored="true" /> 

solrconfig.xml

 <requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="defType">edismax</str> <str name="spellcheck.dictionary">default</str> <str name="spellcheck.onlyMorePopular">false</str> <!-- <str name="spellcheck.extendedResults">false</str> --> <str name="spellcheck.count">3</str> <str name="qf"> frontlist_flapcopy^0.5 title^2.0 subtitle^1.0 series^1.5 author^3.0 frontlist_ean^6.0 </str> <str name="pf"> frontlist_flapcopy^0.5 title^2.0 subtitle^1.0 series^1.5 author^3.0 frontlist_ean^6.0 </str> <str name="fl"> title,subtitle,series,author,eans,formats,prices,frontlist_ean,onsaledate,imprint,frontlist_flapcopy </str> <str name="mm"> 2&lt;-1 5&lt;-2 6&lt;90% </str> <int name="ps">100</int> <bool name="hl">true</bool> <str name="q.alt">*:*</str> <str name="hl.fl">title,subtitle,series,author,frontlist_flapcopy</str> <str name="f.title.hl.fragsize">0</str> <str name="f.title.hl.alternateField">title</str> <str name="f.subtitle.hl.fragsize">0</str> <str name="f.subtitle.hl.alternateField">url</str> <str name="f.series.hl.fragsize">0</str> <str name="f.series.hl.alternateField">url</str> <str name="f.author.hl.fragsize">0</str> <str name="f.author.hl.alternateField">url</str> <str name="f.frontlist_flapcopy.hl.fragsize">0</str> <str name="f.frontlist_flapcopy.hl.alternateField">url</str> <str name="echoParams">explicit</str> <float name="accuracy">0.7</float> </lst> <lst name="appends"> <str name="fq">forsaleinusa:true</str> </lst> <arr name="last-components"> <str>spellcheck</str> </arr> </requestHandler> <!-- CUT --> <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <str name="name">default</str> <str name="classname">solr.IndexBasedSpellChecker</str> <str name="field">spell</str> <str name="spellcheckIndexDir">/path/to/my/spell/index</str> <str name="accuracy">0.7</str> <float name="thresholdTokenFrequency">.0001</float> </lst> <lst name="spellchecker"> <str name="name">jarowinkler</str> <str name="classname">solr.IndexBasedSpellChecker</str> <str name="field">spell</str> <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str> <str name="spellcheckIndexDir">/path/to/my/spell/index</str> </lst> <str name="queryAnalyzerFieldType">textSpell</str> </searchComponent> 

When I go to http://localhost:8983/solr/select/?q=query&spellcheck.build=true , then look at the files generated in / path / to / my / spell / index, there is segment.gen and segments_1, both of which contain only a few bytes of binary data. Then, when I enter the query and add &spellcheck=true to the query string, I get no suggestions, regardless of my query:

 <lst name="spellcheck"> <lst name="suggestions"/> </lst> 

Any idea what is going on here?

+5
source share
2 answers

I decided to solve this problem a while ago, but, to my memory, the problem was that I used several <copyField/> directives to copy the data to the "spell" field, but I did not set multiValued="true" on this field . When I made the spellcheck checkbox ambiguous, it worked like a charm!

+2
source

I had a very similar problem that I could not solve. Someone posted a detailed answer to my question that might help you:

Solr sentence returns no results

+3
source

All Articles