Sitecore Suggest No suggester named default was configured

Recently I was testing out SOLR’s suggester functionality through the  Sitecore API. There is a slight gap in the documentation and I kept receiving the error No suggester named default was configured.

<?xml version="1.0" encoding="UTF-8"?>
   <lst name="responseHeader">
      <int name="status">400</int>
      <int name="QTime">22</int>
   <lst name="error">
      <lst name="metadata">
         <str name="error-class">org.apache.solr.common.SolrException</str>
         <str name="root-error-class">org.apache.solr.common.SolrException</str>
      <str name="msg">No suggester named default was configured</str>
      <int name="code">400</int>


This error is caused because the Response Handler does not know which dictionary to use. This can be resolve in two ways:


Option 1 Specify the dictionary in the request handler. Once this change has been made you must reload the SOLR core

<?xml version="1.0" encoding="UTF-8"?>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
   <lst name="defaults">
      <str name="suggest.dictionary">mySuggester</str>
      <str name="suggest">true</str>
      <str name="suggest.count">10</str>
   <arr name="components">


Option 2 Add the dictionary into the parameters

using (IProviderSearchContext context = index.CreateSearchContext())
    SolrSuggestQuery q = searchtext;
    var options = new SuggestHandlerQueryOptions
        Parameters = new SuggestParameters
            Count = 3,
            Build = true,
            <strong>Dictionary = "mySuggester"</strong>
    var result = context.Suggest(q, options);
    var suggestions = result.Suggestions["mySuggester"].Suggestions.Select(x =&amp;gt; x.Term);

Further Reading

Leave a Reply

Your email address will not be published. Required fields are marked *