Solr - 建议者不回复任何暗示

时间:2014-01-08 16:21:08

标签: apache solr lucene

我正在尝试设置Solr suggester模块。

我已按照guide并设置我的核心:

solrconfig.xml中

<searchComponent class="solr.SpellCheckComponent" name="suggest">
   <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>
      <str name="field">city</str>  <!-- the indexed field to derive suggestions from -->
      <float name="threshold">0</float>
      <str name="buildOnCommit">true</str>  
   </lst>
</searchComponent>

<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
   <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">suggest</str>
      <str name="spellcheck.onlyMorePopular">false</str>
      <str name="spellcheck.count">5</str>
      <str name="spellcheck.collate">true</str>
   </lst>
   <arr name="components">
      <str>suggest</str>
   </arr>
</requestHandler>

schema.xml中

<types>

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

   </types>

   <fields>
       <!--  my other fieldsfields -->

       <field name="city" type="textSpell" indexed="true" stored="true"/>
   </fields>

然后使用以下方法重建拼写检查:

http://localhost:4569/solr/myCore/suggest?q=a&spellcheck=true&spellcheck.build=true

然后进行搜索:

http://localhost:4569/solr/myCore/suggest?q=aberdean&spellcheck=true&spellcheck=on

但我总是在回复中得到一个空洞的建议:

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">1</int>
    </lst>
    <lst name="spellcheck">
    <lst name="suggestions"/>
    </lst>
 </response>

我已查看了建议in this question

知道为什么我没有得到结果?

1 个答案:

答案 0 :(得分:0)

你能提交并尝试查询吗?我想这是因为

<str name="buildOnCommit">true</str>

你可以再试一次吗。