2012-09-19 22 views
3

目前正在Solr 3.6中使用Suggesters。我已經將Suggester配置爲提供外部字典源。如何在Suggester中忽略大小寫? Solr 3.6

solrconfig.xml中:

<searchComponent name="spellcheck" class="solr.SpellCheckComponent"> 

    <str name="queryAnalyzerFieldType">textSpell</str> 

    <lst name="spellchecker"> 
     <str name="name">suggest</str> 
     <str name="classname">org.apache.solr.spelling.suggest.Suggester</str> 
     <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str> 
     <float name="threshold">0.005</float> 
     <str name="buildOnCommit">true</str> 
    <bool name="exactMatchFirst">true</bool> 
    <str name="sourceLocation">D:\source.txt</str> 

    </lst> 

    </searchComponent> 

的Source.txt:

nokia 2 
nokia 5233 3 
nokia 5130 2 
Symbian 1 
samsung 6712 2 
htc 2 
HTC Wild 6 
htc one 7 
Nokia 1280 5 

當我試圖用 「N」 來搜索,它表明我下面的結果

nokia 5233 
nokia 5130 
nokia 

但結果不包含在「諾基亞1280」中。

可能是什麼原因? 如何在Suggestion中忽略大小寫?

+0

您使用哪個字段的建議?請顯示其類型和schema.xml部分 – Mysterion

+0

他根本沒有使用字段。他正在使用外部字典文件。 – waldol1

回答

1

我覺得這篇文章會幫助你,https://cwiki.apache.org/confluence/display/solr/Suggester

嘗試在你的建議者使用 「域」 參數

<searchComponent name="spellcheck" class="solr.SpellCheckComponent"> 
     <str name="queryAnalyzerFieldType">textSpell</str> 
     <lst name="spellchecker"> 
      <str name="name">suggest</str> 
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str> 
      <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str> 
      <float name="threshold">0.005</float> 
      <str name="buildOnCommit">true</str> 
      <bool name="exactMatchFirst">true</bool> 
      <str name="field">phoneName</str> 
      <str name="sourceLocation">D:\source.txt</str> 
     </lst> 
    </searchComponent> 

字段類型定義

<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100"> 
     <analyzer> 
      <tokenizer class="solr.StandardTokenizerFactory"/> 
      <filter class="solr.StandardFilterFactory"/> 
      <filter class="solr.LowerCaseFilterFactory"/> 
     </analyzer> 
    </fieldType> 

場definetion

<field name="phoneName" type="string" indexed="true" stored="false" required="false" multiValued="false"/>