如何在solr中为probeter配置solrconfig.xml?

时间:2013-01-11 14:47:20

标签: solr autocomplete

我已按照http://wiki.apache.org/solr/Suggester中的建议配置我的solrconfig.xml以使用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>

然而,当我从浏览器网址浏览时,我没有得到任何建议。

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过滤器,我也没有得到建议。

请帮忙。

由于

1 个答案:

答案 0 :(得分:1)

我不确定,您可以尝试在

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