简体   繁体   中英

How to configure solrconfig.xml for suggester in solr?

I have configured my solrconfig.xml to use Suggester component as suggested in 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>

However, when i browse from the browser url i am not getting any suggestions.

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>

Even if i remove the fq filter, I am not getting the suggestions.

Please help.

Thanks

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM