Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
Experience Sitecore! | Configuring search for SXA 1.8

Experience Sitecore!

Martin Miles on Sitecore

Configuring search for SXA 1.8

I was following the official guidance, so dropped search box component to my header and configured search results parameter. Then created page /search and dropped search results on it. Tested and got an exception (from logs):

14260 17:31:37 ERROR Unable to connect to [https://localhost:8983/solr], Core: [sitecore_sxa_master_index]
Exception: SolrNet.Exceptions.SolrConnectionException
Message: 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Error 404 Not Found</title>
<h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/sitecore_sxa_master_index/schema. Reason:
</p><pre>Not Found</pre><p></p>

Source: SolrNet
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   at Sitecore.ContentSearch.SolrNetExtension.Impl.SolrBasicServerEx`1.GetSchema(String collection)
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.InitializeSchema()
   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.InitializeSolr()

Nested Exception
Exception: System.Net.WebException
Message: The remote server returned an error: (404) Not Found.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
14260 17:31:37 ERROR Unable to connect to [https://localhost:8983/solr], Core: [sitecore_sxa_web_index]

Exception: SolrNet.Exceptions.SolrConnectionException

Obviously, my SXA indexes got misconfigured, and Sitecore Indexing manager showed nothing there. I identified a responsible config file: App_Config/Modules/SXA/Z.Foundation.Overrides/Sitecore.XA.Foundation.Search.Solr.config - it adds two SXA-related indexes as below (irrelevant lines skipped):

<index id="sitecore_sxa_master_index">
  <param desc="name">$(id)</param>
  <param desc="core">$(id)</param>
</index>

I tried populating schema:


 But got such an exception:


Looking at Solr I've noticed that all my cores are prefixed (ie. Platform_master_index) by the installation, so obviously there are no such cores (ie. sitecore_sxa_master_index). Indexing Manager claims these as "never run". I decided to collocate SXA indexes within cores for corresponding databases, along with traditional non-SXA indexes.  So that both indexes sitecore_master_index and sitecore_sxa_mater_index will reside within Platform_master_index core.

So I ended up making this patch Foundation.ContentSearch.config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
  <sitecore search:require="solr">
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="sitecore_sxa_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider" role:require="Standalone or Reporting or ContentManagement or Processing">
            <param desc="core" patch:instead="param[@desc='core']">Platform_master_index</param>
          </index>
          <index id="sitecore_sxa_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider" role:require="Standalone or ContentDelivery or ContentManagement or Reporting">
            <param desc="core" patch:instead="param[@desc='core']">Platform_web_index</param>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

Once patch applied, I've re-populated schema again and it worked and after refreshing the page search box worked well, including predictive search!

blog comments powered by Disqus