You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by xing hu <hu...@gmail.com> on 2011/12/21 09:00:46 UTC
Suggest don't work like spellcheck
Hi All:
I'm trying the Suggest Component to provide auto-suggest. But i find a
problem when use it.
First i use the spellcheck component,it's support check the spell and
return the right spell, so i think Suggest Component can also return the
right spell term.
but the Suggest Component seems don't return the right spell. Anybody know
why?
this is my solr-config.xml and search results.
spellcheck component:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<!--
<str name="queryAnalyzerFieldType">textSpell</str>
-->
<lst name="spellchecker">
<!--
<str name="classname">solr.IndexBaseSpellChecker</str>
-->
<str name="name">default</str>
<str name="field">spu_name</str>
<str name="spellcheckIndexDir">spellchecker</str>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="spellcheck.onlyMorePopular">false</str>
<str name="spellcheck.extendedResults">false</str>
<str name="spellcheck.count">2</str>
<str name="spellcheck">true</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
http://localhost:8080/solr/spell?spellcheck.q=iped&rows=0&indent=on&q=*:*
search result :
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">30</int>
</lst>
<result name="response" numFound="4890" start="0"/>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="iped">
<int name="numFound">2</int>
<int name="startOffset">0</int>
<int name="endOffset">4</int>
<arr name="suggestion">
<str>ipad</str>
<str>ipod</str>
</arr>
</lst>
</lst>
</lst>
</response>
Suggest Component:
solr-config.xml:
<searchComponent name = "suggest" class="solr.SpellCheckComponent">
<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">spu_name</str>
<float name="threshold">0.005</float>
<str name="spellcheckIndexDir">spellchecker</str>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
<requestHandler class="solr.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">8</str>
<str name="spellcheck.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
curl "http://localhost:8080/solr/suggest?q=ipe"
search result:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions"/>
</lst>
</response>
How to take the Suggest's response like spellcheck? any suggestion?
--
iamxhu
GTalk:huxing1985@gmail.com
my blog:www.colorfuldays.org