Wednesday, June 11, 2025

Solving Search Result Issues After Upgrading to Sitecore 10.4

Hey everyone! 👋

As you might have seen in some of our previous blogs, we’ve shared quite a bit about upgrading Sitecore versions. Well, we recently made the jump from Sitecore 10.1 to 10.4, and just like any major upgrade, we encountered a few bumps along the way. But don’t worry—we’re here to share one of the issues we ran into and how we managed to solve it. So, let’s dive in!

The Problem: Search Results Vanishing After the Upgrade

After upgrading Sitecore, everything seemed to go smoothly at first. But then, some of our websites (we have over 170 websites hosted in Sitecore) suddenly stopped showing search results. Some sites were working just fine, but others? Not so much. 🤔

As you can imagine, this was pretty concerning. We started investigating the issue to figure out if it was related to the upgrade itself or some recent configuration changes. So, we dug into the logs and checked the configurations.

Digging Deeper: What We Found

After some digging, we discovered something interesting: our search page was using a custom index, and the results were relying on a field called sxacontext. But guess what? This field was missing in the custom indexes after the upgrade.

So, what’s going on here?

Well, it turns out that the fields were no longer present in the default index configuration. Instead, they were added to the individual SXA indexes like sxa_master_index and sxa_web_index. Since our search page depended on the sxacontext field within our custom site-specific indexes, the missing field was the culprit. 🚨

What Happened in Sitecore 10.3 and Beyond?

Here’s where things got a bit tricky: In SXA version 10.3, a few SXA computed fields were removed from the defaultSolrIndexConfiguration. This change wasn’t really a problem for the default SXA indexes, but for custom indexes like ours, it caused issues—especially when relying on fields like sxacontext.

The Fix: Restoring the Missing Fields

We figured out that the best way to resolve the issue was to re-add the missing fields back into the default Solr index configuration. After a bit of trial and error, we managed to update the configuration so that the custom index could properly use those fields again.

Here’s what our updated defaultSolrIndexConfiguration looks like now:

Updated Default Solr Index Configuration:

<?xml version="1.0" encoding="utf-8"?>
<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>
      <indexConfigurations>
        <defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider" >
          <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
           
            <fields hint="raw:AddComputedIndexField">
               
                <field fieldName="site" returnType="stringCollection">Sitecore.XA.Foundation.Search.ComputedFields.Site, Sitecore.XA.Foundation.Search</field>
                <field fieldName="sxacontent" returnType="textCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.AggregatedContent, Sitecore.XA.Foundation.Search">
                    <mediaIndexing ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/mediaIndexing"/>
                </field>
                <field fieldName="haslayout" returnType="bool">Sitecore.XA.Foundation.Search.ComputedFields.HasLayout, Sitecore.XA.Foundation.Search</field>
                <field fieldName="searchable">Sitecore.XA.Foundation.Search.ComputedFields.Searchable, Sitecore.XA.Foundation.Search</field>
                <field fieldName="parentname" returnType="string">Sitecore.XA.Foundation.Search.ComputedFields.ParentName, Sitecore.XA.Foundation.Search</field>
                <field fieldName="level" returnType="int">Sitecore.XA.Foundation.Search.ComputedFields.Level, Sitecore.XA.Foundation.Search</field>
                <field fieldName="parenttemplate" returnType="string">Sitecore.XA.Foundation.Search.ComputedFields.ParentTemplate, Sitecore.XA.Foundation.Search</field>
                <field fieldName="inheritance" returnType="stringCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.Inheritance, Sitecore.XA.Foundation.Search"/>
            </fields>
          </documentOptions>
        </defaultSolrIndexConfiguration>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

The Result: Success!

After making these updates, search results started showing up again. 🎉

So, if anyone else runs into this issue—where search results are missing, or if certain fields are not showing up because they were moved to specific indexes (like we saw with sxacontext)—this configuration change should get things back on track.

Conclusion: Key Takeaways

Upgrading Sitecore can sometimes be a bit tricky, but with the right troubleshooting steps, most issues are solvable! Here’s what we learned from this experience:

  1. Always double-check your index configurations after an upgrade, especially if you use custom indexes.

  2. Look out for missing fields—they could be causing issues in unexpected places.

  3. Update your configuration files to reintroduce any fields that might have been removed or moved to other indexes (like the SXA computed fields).

If you’re facing a similar issue after an upgrade, don’t panic. Follow the steps we took, and you should be able to get your search results back up and running.

Have you encountered any issues after upgrading to Sitecore 10.4? Drop a comment below or reach out if you need help! We’d love to hear about your experience. 😊

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

No comments:

Post a Comment