Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solr 5.3 - suggest feature not working

I added the search component and the request handler in the solrconfig.xml file, but I get an error saying

"No suggester named default was configured" when I type ../../suggest?suggest.q=A&wt=json&suggest.build=true&indent=true&debugQuery=true in the browser

like image 885
Anusha Avatar asked Feb 02 '16 06:02

Anusha


1 Answers

Suppose your search component is:

<searchComponent name="suggest" class="solr.SuggestComponent">
 <lst name="suggester">
   <str name="name">mySuggester</str>
             ...
 </lst>

First way:

You must add "dictionary" parameter to your request handler default parameters as follows:

<requestHandler name="/suggest" class="solr.SearchHandler">
 <lst name="defaults">
   <str name="suggest.dictionary">mySuggester</str>
   <str name="suggest">true</str>
   <str name="suggest.count">10</str>
 </lst>
 <arr name="components">
   <str>suggest</str>
 </arr>
</requestHandler>

Second way:

If you haven't specified "dictionary" parameter in your request handler default parameters, you must add it to URL.

For example:

<requestHandler name="/suggest" class="solr.SearchHandler">
 <lst name="defaults">
   <str name="suggest">true</str>
   <str name="suggest.count">10</str>
 </lst>
 <arr name="components">
   <str>suggest</str>
 </arr>
</requestHandler>

Then you can use following url:

../../suggest?suggest.dictionary=mySuggester&q=A&wt=json&suggest.build=true&indent=true&debugQuery=true
like image 105
Abolfazl Hashemi Avatar answered Oct 19 '22 11:10

Abolfazl Hashemi