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 "stiven.zhou@swisoft.cn" <st...@swisoft.cn> on 2018/02/03 05:26:01 UTC
The Expected Suggestions Is Phrase Instead Of Whole Contents From Field
Hi Dear Solr,
I config the Solr to try to get search suggestion but seem not the suggestion that I want.
the follow search component and request handler:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">title</str> // the contents is from "title"
<str name="suggestAnalyzerFieldType">string</str>
<str name="buildOnStartup">false</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">mySuggester</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
http://localhost:8983/solr/articles/suggest?hl=on&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=hello&suggest=true
the result is :
{
"responseHeader":{
"status":0,
"QTime":14},
"command":"build",
"suggest":{"mySuggester":{
"hello":{
"numFound":3,
"suggestions":[{
"term":"hello every one, im rebot", // the whole contents from field "title"
"weight":0,
"payload":""},
{
"term":"hello the autosuggest feature to satisfy two main requirements", // the whole contents from field "title"
"weight":0,
"payload":""},
{
"term":"hello world, Im program", // the whole contents from field "title"
"weight":0,
"payload":""}]}}}}
BUT the expected result should be phrase instead of the whole contents from the field "title" :
"suggestions":[{
"term":"hello every one", // expected result should be phrase like this
"weight":0,
"payload":""},
{
"term":"hello autosuggest", // expected result should be phrase like this
"weight":0,
"payload":""},
{
"term":"hello world", // expected result should be phrase like this
"weight":0,
"payload":""}]}}}}
So what is wrong? Did I config anything wrong?
thanks a lot for the help
Stiven.Zhou
stiven.zhou@swisoft.cn
Re: The Expected Suggestions Is Phrase Instead Of Whole Contents
From Field
Posted by Alessandro Benedetti <a....@sease.io>.
I am sorry but what you get is the expected behavior [1]
Maybe you are interested to the free text lookup approach[2].
Cheers
[1] https://sease.io/2015/07/solr-you-complete-me.html
[2]
https://lucene.apache.org/solr/guide/6_6/suggester.html#Suggester-FreeTextLookupFactory
-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html