0

I am using Sitecore 9.0.1 rev. 171219 with SXA 1.6 rev 180103 and Solr 6.6.2.

In the SXA site, search results text box suggestions giving error as "/site_masterindex/suggest" not found. Solr search admin showing search results and in SC Item query/Search Scope while building query. Also search results not displaying in the search results component.

I already disabled the following files at App_Config\Include\Z.Foundation.Overrides\ and enabled only Sitecore.XA.Foundation.Search.Solr.config:

  • Sitecore.XA.Foundation.Search.Azure.config.disabled
  • Sitecore.XA.Foundation.Search.Lucene.config.disabled
  • In Sitecore.XA.Foundation.Search.Solr.config file "core" node is also disabled:
<!--
 <index id="sitecore_sxa_master_index" type="Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex, Sitecore.XA.Foundation.Search.Providers.Solr" role:require="Standalone or Reporting or ContentManagement or Processing">
  <param desc="name">$(id)</param>
  <param desc="core">$(id)</param>
  <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
  <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
  <strategies hint="list:AddStrategy">
   <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
  </strategies>
  <locations hint="list:AddCrawler">
   <crawler type="Sitecore.XA.Foundation.VersionSpecific.Search.SxaItemCrawler, Sitecore.XA.Foundation.VersionSpecific">
    <Database>master</Database>
    <Root>/sitecore</Root>
   </crawler>
  </locations>
  <enableItemLanguageFallback>false</enableItemLanguageFallback>
  <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
 </index>
 <index id="sitecore_sxa_web_index" type="Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex, Sitecore.XA.Foundation.Search.Providers.Solr" role:require="Standalone or ContentDelivery or ContentManagement or Reporting">
  <param desc="name">$(id)</param>
  <param desc="core">$(id)</param>
  <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
  <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
  <strategies hint="list:AddStrategy">
   <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
  </strategies>
  <locations hint="list:AddCrawler">
   <crawler type="Sitecore.XA.Foundation.VersionSpecific.Search.SxaItemCrawler, Sitecore.XA.Foundation.VersionSpecific">
    <Database>master</Database>
    <Root>/sitecore</Root>
   </crawler>
  </locations>
  <enableItemLanguageFallback>false</enableItemLanguageFallback>
  <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
 </index>
 -->

I followed the url https://wiki.apache.org/solr/Suggester and placed the xml file http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_3_6/solr/core/src/test-files/solr/conf/solrconfig-phrasesuggest.xml at solr-6.6.2\server\solr\_master_index\conf but still suggestions are not working.

While searching the item in search text box, below url with 500 internal server error showing in console: http://sc9test1.sc:801/sitecore/content/tenantfoldername/tenantname/sitename/home/sxa/search/suggestions/?q=xik&v={C823C957-18D9-4A34-B31C-20AE3A622E3E}&p=5&s={FB0FE6BD-2AF0-4A51-A571-539C47F89157}

And while accessing above url directly on browser, i am getting error:

{"Message":"An error has occurred.","ExceptionMessage":"<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n<title>Error 404 Not Found</title>\n</head>\n<body><h2>HTTP ERROR 404</h2>\n<p>Problem accessing /solr/SC9Test1_master_index/suggest. Reason:\n<pre>    Not Found</pre></p>\n</body>\n</html>\n","ExceptionType":"SolrNet.Exceptions.SolrConnectionException","StackTrace":"   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)\r\n   at Sitecore.ContentSearch.SolrNetExtension.Impl.SolrQueryExecuterEx`1.Execute(SolrSuggestQuery query, SuggestHandlerQueryOptions options)\r\n   at Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.SolrNetProxy.Suggest(IProviderSearchContext context, SolrSuggestQuery q, SuggestHandlerQueryOptions options)\r\n   at Sitecore.XA.Foundation.VersionSpecific.Services.SolrSuggester.GetSuggestions(String term, Timer& queryTimer, String& indexName)\r\n   at Sitecore.XA.Feature.Search.Controllers.SearchController.SearchSuggestions(String q, String s, String l, String sig, String site)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"The remote server returned an error: (404) Not Found.","ExceptionType":"System.Net.WebException","StackTrace":"   at System.Net.HttpWebRequest.GetResponse()\r\n   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()\r\n   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)\r\n   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)"}}

Please provide provide pointers to resolve this issue.

  • Please check whether Solr service url is updated or not. And it should be hosted with https for sitecore 9. – NSP Feb 18 '18 at 15:01
  • Solr search running with https and returning results in query window. – Amit Kumar Feb 18 '18 at 15:20
2

First of all, while using Sitecore 9.0 and above you don't need to disable any search configs which comes with SXA. Starting from Sitecore 9.0 you can use rule-based configuration. Depending on web.config setting <add key="search:define" value="Lucene" /> you can use either Lucene, Solr or Azure without any need to disable or enable any configuration file. So please enable everything that you've disabled so far.

Regarding the suggestions. SXA offers few modes how the suggestions will be displayed. You can configure them in the Search Box control properties dialogue:

enter image description here

In order to use real suggestions provider search engine, you need to choose "Show predictions". What is important - this option will work just on Solr and Sitecore 9.0 and above. Those suggestion are not supported on 8.2 and search engine other than Solr.

And the most important thing! SXA is using suggester called sxaSuggester. Please name your Solr suggester in that way and it will be working fine.

  • Hi Dawid, Thanks for the information. I enabled all the configs and tried to setup sxaSuggester using lucene.apache.org/solr/guide/6_6/suggester.html at my solr instance solrconfig.xml (D:\Amit\solr-6.6.2\server\solr\configsets\data_driven_schema_configs\conf\solrconfig.xml): – Amit Kumar Feb 19 '18 at 5:57
  • The suggest component added after the terms' component requesthandler attribute: <searchComponent name="suggest" class="solr.SuggestComponent"><lst name="suggester"><str name="name">sxaSuggester</str><str name="lookupImpl">FuzzyLookupFactory</str><str name="dictionaryImpl">DocumentDictionaryFactory</str><str name="field">title</str><str name="weightField">price</str><str name="suggestAnalyzerFieldType">string</str><str name="buildOnStartup">false</str></lst></searchComponent><requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" ><lst name="defaults"> – Amit Kumar Feb 19 '18 at 6:09
  • <str name="suggest">true</str><str name="suggest.count">10</str></lst><arr name="components"><str>suggest</str></arr></requestHandler>. But still suggestions are not coming but search results started working. Thanks for your valuable time. – Amit Kumar Feb 19 '18 at 7:25
0

Following Sitecore's documentation will help you configure Solr for suggest, but will not lead to a working suggester right away!

I tried to implement the Suggester (without SXA) and took me a while to figure it out:

Suggester section:

<searchComponent name="suggest" class="solr.SuggestComponent">
  <lst name="suggester">
    <str name="name">suggesterName</str>
    <str name="field">customcontent_s</str>
    <str name="suggestAnalyzerFieldType">string</str>
    <str name="buildOnStartup">false</str>
  </lst>
</searchComponent>

Suggester Request Handler:

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
  <lst name="defaults">
    <str name="suggest.dictionary">suggesterName</str>
    <str name="suggest">true</str>
    <str name="suggest.count">10</str>
  </lst>
  <arr name="components">
    <str>suggest</str>
  </arr>
</requestHandler>
  • I had to remove the lookupImpl and dictionaryImpl from the suggester component to keep the defaults. Of course you can keep them but will have to add any needed extra parameters according to the documentation
  • I also added the <str name="suggest.dictionary">suggesterName</str> to the request handler with the same name defined in the suggest component

The above configurations worked just fine with me.

Please see this blog post for more details

  • Hi, i have added the above config details with suggester name as "sxaSuggester" and accessed the page as localhost:8983/solr/<sitename>_master_index/…, but still getting HTTP ERROR 404. After adding above configs, are there any other changes required? – Amit Kumar Feb 19 '18 at 9:44
  • I think you configured the Suggester in the wrong core (not <sitename>_master_index) or you've not reloaded your core after saving the changes? – TamerM Feb 19 '18 at 9:54
  • Are you reloading the core or restarting jetty service after the config changes? – TamerM Feb 19 '18 at 9:56
  • I have added search component node mentioned above after the terms search component request handler. I am new to Solr , can you please let me know how to reload the core/jetty service to reflect changes? – Amit Kumar Feb 19 '18 at 13:14
  • After you do any changes to the core configs, the core needs to be reloaded either by restarting your Solr service that you've created or going to the Solr admin page > Core Admin, then clicking on the Reload button – TamerM Feb 19 '18 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.