【发布时间】:2015-02-09 13:47:44
【问题描述】:
我正在 Solr 中进行拼写检查。我在拼写检查器组件中实现了Suggestions和collations。
Most of the time collations work fine but in few case it fails.
工作:
我试过query:gone wthh thes wnd:在这个wnd中没有给出建议wind但是collation来了正确 = 随风而逝,hits = 117
不工作:
但是当我尝试query: gone wthh thes wint:在这方面,wint 确实给出了建议 wind 但 collation 不会来强>对。而不是随风而逝,而是随风而逝,hits = 1
我也想知道collations中的hits是什么。
配置:
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>
【问题讨论】:
标签: solr collation spell-checking search-suggestion