0

我已将我的 solrconfig.xml 配置为使用 Suggester 组件,如http://wiki.apache.org/solr/Suggester.

<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.fst.FSTLookup</str>
      <str name="field">name</str>
      <!-- the indexed field to derive suggestions from -->
      <float name="threshold">0.005</float>
      <str name="buildOnCommit">true</str>
      <!--
      <str name="sourceLocation">american-english</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">true</str>
      <str name="spellcheck.count">5</str>
      <str name="spellcheck.collate">true</str>
    </lst>
    <arr name="components">
      <str>suggest</str>
    </arr>
  </requestHandler>

但是,当我从浏览器 url 浏览时,我没有得到任何建议。

http://localhost:8080/solr/collection1/suggest?q=ava&fq=type%3ACategory&wt=xml

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

即使我删除了 fq 过滤器,我也没有得到建议。

请帮忙。

谢谢

4

1 回答 1

1

我不确定,您可以尝试添加 spellcheck=on

http://localhost:8080/solr/collection1/suggest?q=ava&spellcheck=on&fq=type%3ACategory&wt=xml
于 2013-03-05T05:00:53.793 回答