autosuggest - How to make solr suggestion work for a specific field? -


i trying implement auto suggest of solr changes made in solrconfig.xml file

<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> <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.tst.tstlookupfactory</str>   <str name="field">displayname</str>  <!-- indexed field derive suggestions -->   <float name="threshold">0.005</float>   <str name="buildoncommit">true</str> </lst> </searchcomponent> 

when try query sample input 'p'

http://localhost:8983/solr/food/suggest?q=p&wt=json&indent=true 

it returns 5 words

"pizza", "potato", "pasta", "protein", "premium"

but in displayname field got words paneer , palak etc not showing why so?

can added following configuration , run below query. don't forget reload solr core after putting these changes.

<str name="suggestanalyzerfieldtype">string</str> <str name="storedir">suggester_fuzzy_dir</str> 

http://localhost:8983/solr/food/suggest?suggest=true&suggest.build=true&suggest.dictionary=suggest&wt=json&suggest.q=p&suggest.count=10


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -