2015-02-09 23 views
0

我正在處理拼寫檢查Solr。我在我的拼寫檢查組件中實施了建議排序規則校對器在Solr中工作不正常

Most of the time collations work fine but in few case it fails. 

工作:

我試圖query:gone wthh thes wnd:在本WND不給建議整理即將 = 隨風而逝hits = 117

不工作:

但當我query: gone wthh thes wint:在此,WINT確實給建議整理不來權。取而代之的隨風了它給走了與西方hits = 1

而且我也想知道什麼是歸類命中

配置:

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> 

回答

0

我得到了我的問題的答案。深入閱讀後,我發現排序規則背後的邏輯。

1) spellcheck.maxCollations:它只是使整理候選人測試索引。

2) spellcheck.maxCollationTries :它評估在spellcheck.maxCollat​​ions時生成的排序規則。如果我們設置的spellcheck.maxCollationTries值,那麼它給更好的排序規則而如果我們設置的spellcheck.maxCollationTries值,那麼它給更覈對結果,但它損害性能

因此,通過增加spellcheck.maxCollationTries價值,它給的了wthh THES WINT了與風,但我再說一遍,這危害性能的排序規則。

+0

我想做拼寫/查詢修正功能。我有49 GB的索引數據,我已經應用了拼寫檢查器。我想和谷歌一樣 - 「你的意思是」。 示例 - 如果任何用戶輸入任何可能拼寫錯誤或錯誤輸入的問題/查詢。我需要給他們一些建議,比如「你的意思是」。 Solr最適合它嗎? – iNikkz 2015-02-23 16:24:16