I am working on spell checking in Solr. I have implemented Suggestions and collations in my spell checker component.
Most of the time collations work fine but in few case it fails.
Working:
I tried query:gone wthh thes wnd
: In this wnd doesn't give suggestion wind but collation is coming right = gone with the wind, hits = 117
Not working:
But when I tried query: gone wthh thes wint
: In this, wint does give suggestion wind but collation is not coming right. Instead of gone with the wind it gives gone with the west, hits = 1
And I also want to know what is hits in collations.
Configuration:
solrconfig.xml:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<str name="queryAnalyzerFieldType">textSpellCi</str>
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">gram_ci</str>
<str name="classname">solr.DirectSolrSpellChecker</str>
<str name="distanceMeasure">internal</str>
<float name="accuracy">0.5</float>
<int name="maxEdits">2</int>
<int name="minPrefix">0</int>
<int name="maxInspections">5</int>
<int name="minQueryLength">2</int>
<float name="maxQueryFrequency">0.9</float>
<str name="comparatorClass">freq</str>
</lst>
</searchComponent>
<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="df">gram_ci</str>
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck">on</str>
<str name="spellcheck.extendedResults">true</str>
<str name="spellcheck.count">25</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.maxResultsForSuggest">100000000</str>
<str name="spellcheck.alternativeTermCount">25</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.maxCollations">50</str>
<str name="spellcheck.maxCollationTries">50</str>
<str name="spellcheck.collateExtendedResults">true</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
Schema.xml:
<field name="gram_ci" type="textSpellCi" indexed="true" stored="true" multiValued="false"/>
</fieldType><fieldType name="textSpellCi" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory" maxShingleSize="5" minShingleSize="2" outputUnigrams="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory" maxShingleSize="5" minShingleSize="2" outputUnigrams="true"/>
</analyzer>
</fieldType>