Showing posts with label solr. Show all posts
Showing posts with label solr. Show all posts

Monday, November 3, 2025

Troubleshooting the “Bad Message 414 — URI Too Long” Error in Sitecore SXA

 

Hey everyone,

I recently encountered an issue from one of my colleagues that I thought might be worth sharing. One of the developers on our team was hitting an error while trying to perform a build query from the Scope in an SXA-based Sitecore site. The specific URL in question was something like:

/sitecore/content/website/Settings/Scopes/Scope1


At first glance, I thought the issue was related to security permissions. I suggested checking the security settings for the relevant user group, feeling pretty confident in my assumption. 😎 However, after a deeper dive, I realized that there was more going on under the hood.

Initial Investigation

My colleague confirmed that the user had all the necessary permissions according to our team, but I still couldn’t shake the feeling that something was wrong. I decided to test it with my own credentials (admin access, of course 😜), and I was able to see the results without any issues. This raised a red flag for me — if the permissions were fine for the user, then why was I able to see the results while they couldn’t?

This led me to think that security indexing might be playing a role here, since admins generally bypass certain security checks. After checking everything again and reindexing, I was still stuck. So, I took the next logical step — investigating the logs.

Solving the Puzzle: The “Bad Message 414 — URI Too Long” Error

When I checked the logs and tried to run the query directly through Solr’s console, I was met with the following error message:

<h1>Bad Message 414</h1>
 <pre>reason: URI Too Long</pre>

At this point, I started digging into what “Bad Message 414 — URI Too Long” actually meant. The “414” error indicates that the query string exceeds the maximum allowed length for HTTP GET requests. In Sitecore SXA, this can happen when scopes or filters are applied, generating long query strings that exceed the allowed limit.


Why Does This Happen?

In Sitecore SXA, when you’re working with scopes and search queries, the system often generates a URL with a long query string. This can be problematic because HTTP GET requests have a length limit for the URL (usually around 8192 characters). If the query string becomes too long (which can happen with complex search filters or scopes), Solr will reject the request, and you’ll get the “URI Too Long” error.

So, what can you do about it?

Solutions to Fix the Issue

There are two primary solutions to resolve the “Bad Message 414” error in Sitecore SXA:

1. Switch to HTTP POST Method

The first option is to switch your query to use the HTTP POST method instead of GET. POST requests don’t have the same URL length limitations as GET requests, which can help avoid the “URI Too Long” error. To do this, you’ll need to update your query handling to send data via POST rather than GET.

2. Increase Solr’s Request Header Size

If switching to POST doesn’t work or isn’t a viable option for your implementation, you can increase the maximum allowed size for Solr’s request headers. This solution worked for me, and it’s relatively simple to implement.

Here’s how to increase Solr’s request header size:

  1. Locate the Jetty Configuration File
     
    Open the jetty.xml file in your Solr installation directory. The typical path for this file is:
     SOLR_HOME/server/etc/jetty.xml
  2. Modify the Request Header Size
     
    In the jetty.xml file, locate the following block:
     <Set name=”requestHeaderSize”>
     <Property name=”solr.jetty.request.header.size” default=”8192" />
     </Set>
  3. Increase the Header Size
     
    Change the value from 8192 (the default size) to something larger. For example:
     <Set name=”requestHeaderSize”>
     <Property name=”solr.jetty.request.header.size” default=”29000" />
     </Set>
  4. Save and Restart
     
    Save the file and restart both Solr and Sitecore.

After applying this update, I was able to resolve the issue and the query started working properly!

Conclusion

So, that’s how I tracked down and fixed the “Bad Message 414 — URI Too Long” error in Sitecore SXA. If you’re ever in a similar situation, here are the steps I took:

  • Check security settings (permissions and indexing)
  • Investigate the error logs
  • Run the query directly in Solr’s console to identify the root cause
  • Either switch to the POST method or increase Solr’s request header size

I hope this helps you avoid a similar headache if you ever run into this issue! Let me know if you have any questions, or if there’s anything I missed. Good luck with your Sitecore projects!

Stay cool,

I hope you enjoy this 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.


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.

Wednesday, November 6, 2024

Sitecore Solr core creation via Powershell

Hi All, 

I am currently engaged in an upgrade project and encountered an issue during the configuration of Solr for the development environment. The existing system contains an excessive number of search indexes that are not displayed in the index manager. This prompted me to manually create cores for Solr. During this process, I discovered over 150 indexes, each corresponding to specific brands. To streamline this task, I decided to automate the process rather than continue with manual creation.

Despite extensive research, I was unable to find any available PowerShell scripts to accomplish this task. Therefore, I decided to develop one myself. This script is designed to facilitate the setup of Solr indexes across multiple environments, including development, QA, UAT, and production. Additionally, it could be beneficial to the community for those undertaking similar tasks.

Below is the PowerShell script. Please feel free to test it by passing the desired index names. Even if it is not immediately necessary, having it on hand could be advantageous.

Reference code: https://github.com/gaurarun777/SitecorePowerShell/blob/main/SolrCoreCreation.ps1

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.

Tuesday, October 9, 2018

Sitecore 9 Installation step by step

Hi Folks,
Today I will try to cover how to install Sitecore Experience Platform 9 Initial Release.
Prerequisites
·       Windows 10
·       Windows PowerShell version 5.1 or later
·       MS SQL Server 2016 SP1 or later
·       MS SQL Management Studio
·       .Net Framework 4.6.2 or later
·       Web Deploy 3.6
·        SOLR 6.6.2
·       Java Runtime Environment
·       NSSM
·       Sitecore Install Framework
·       Packages for XP Single (On Premises deployment)
·       SIFLess.exe (For Quick Installation) optional                               ­­
Installation steps:
At first go with the prerequisites.
If you done with the prerequisites then you need to setup step by step.
1.       Install SQL server and SQL management studio
·       Install MS SQL server and also install MS SQL management studio (ssms) with mix mode authentication and setup password for ‘sa’ user that will be needed for Sitecore installation.
·       MS SQL Server 2017 download from here
·       MS SQL Management Studio 17 down load from here
·       Once you install both above SQL tool then you need to run a new query, for that open ssms and login with ‘SQL Server Authentication’ for user ‘sa’ with the password which you setup in previous step. After login you need to run below query for ‘Contained Database Authentication’
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
2.       Install web deploye 3.6 and JRE
After Install JRE setup environment path as below:
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jre1.8.0_151
3.       Create a new folder F:\Sitecore9_Repository, you can choose your own directory path.
4.       Install Solr 6.6.2
·       Click here for download solr-6.6.2.
·       copy / paste solr-6.6.2.zip to F:\Sitecore9_Repository and unzip it.
·       Open Command prompt as administrator and navigate to bin folder of solr like “F:\Sitecore9_Repository\solr-6.6.2\bin “ and run ‘solr start’ as below:


·       After solr start you need to validate by open browser and navigate to http://localhost:8983/solr/#/
·       That show you running solr instance and showing you dashboard of solr.
5.       For make solr-6.6.2 run as window service instead of manually start all the time need to follow below steps:
·       Click here for download NSSM
·       copy / paste nssm-2.24.zip to F:\Sitecore9_Repository and unzip it
·       Open Command prompt as administrator and navigate to win64  folder of NSSM and run ‘nssm install solr-6.6.2’ command as below and fill the arguments as below:
Application Path: F:\Sitecore9_Repository\solr-6.6.2\bin\solr.cmd
Startup directory: F:\Sitecore9_Repository\solr-6.6.2\bin
Arguments: start –f –p 8983


·       Once you click on Install service a success message come “Service ‘Service Name’ installed Successfully”, now navigate to window service and check with the name ‘solr-6.6.2’ service exist there or not. That service automatically started in case that is stop start it again.





6.       Currently solr working on HTTP , for run solr HTTPS we need to do below steps:
·       Download PowerShell script from here. For download Alt+Click. Paste this script into your Sitecore9_Repository folder.
     Original from here (Thanks kamsar for this contribution).
·       Open PowerShell with Administrator access or in admin mode.
·       Run this command for set unrestricted execution policy else wise you might face “running script is disabled on your system” error.
o   Set-ExecutionPolicy -Scope CurrentUser Unrestricted
·        Now navigate to Sitecore9_Repository folder and run above script as below:
       ./solrssl.ps1
·         After this script will ask to enter path for keytool  if your java sdk or jre not installed on default path.(~program files/java/jre/bin/keytool.exe)
·       Two certificates are generated in Sitecore9_Repository. Copy paste solr-ssl.keystore.jks and solr-ssl.keystore.p12 to F:\Sitecore9_Repository\solr-6.6.2\server\etc
·       open F:\Sitecore9_Repository\solr-6.6.2\bin\solr.in.cmd and add the lines below to it
o   set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks
o   set SOLR_SSL_KEY_STORE_PASSWORD=secret
o   set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks
o   set SOLR_SSL_TRUST_STORE_PASSWORD=secret
·       Here above “secret” is password that is set by “solrssl.ps1” script that you can change by edit the script if you need other password.
·       Restart solr-6.6.2 window service.
·        Open a browser, navigate to https://localhost:8983/
·       Congratulation now your solr run on HTTPS instead of HTTP.

7.       SItecore Installation Framework (SIF)
Open PowerShell(Windows PowerShell ISE) as admin: Run these below commands
·        Register-PSRepository -Name SitecoreGallery -SourceLocationhttps://sitecore.myget.org/F/sc-powershell/api/v2
·        Install-Module SitecoreInstallFramework
·       Update-Module SitecoreInstallFramework

8.       Log into https://dev.sitecore.net/  and download the Sitecore XP Sigle package (Sitecore 9.0.0 rev. 171002 (WDP XP0 packages).zip).


o   copy / paste Sitecore 9.0.0 rev. 171002 (OnPrem)_single.scwdp.zip to F:\Sitecore9_Repository
o   copy / paste Sitecore 9.0.0 rev. 171002 (OnPrem)_xp0xconnect.scwdp.zip to F:\Sitecore9_Repository
o   unzip XP0 Configuration files rev.171002.zip and copy / paste all files to F:\Sitecore9_Repository\Config
In Sitecore configs open sitecore-solr.json and xconnect-solr.json and will check "SolrUrl, SolrRoot and SolrService” parameters.
9.       SIFLESS.EXE for easier Sitecore installation.
·       Download SIFLess.zip and extract to F:\Sitecore9_Repository\SIF
·       Run SIFLess.exe and navigate to EZ mode and fill the details as below:



·       Click on test once everything getting green checks, click on Generate button. That will generate a PowerShell Scripts like SIFXXXXX.PS1
·       Now will run generated final script to create sitecore 9 instance.
·        Open PowerShell as admin:
·        Goto to the path ~/Sitecore9_Repository/SIF/
·        ./SIFXXXXX.PS1
Congratulations once you run above script within some time Sitecore 9 will be installed.

If you run any kind of issue then please go through below blog that will cover some issue which you might face during installation:
     
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.

     




Wednesday, May 16, 2018

Switch Sitecore Lucene Config to Solr the elegant way

When you need to switch your Sitecore instance from Lucene to Solr, you need to disable all Lucene config files and enable the Solr ones. 

Step-by-step guide

Insert your steps.
  1. Open up a powershell window
  2. Change directory to your instance's App_Config\Include 
  3. Execute the following commands:
    1. Disable Lucene Configs
      1
      Dir *.Lucene.*.config -Recurse | % { Rename-Item -Path $_.PSPath -NewName $_.Name.replace(".config",".config.disabled")}
    2. Enable Solr Configs
      1
      2
      Dir *.Solr.*.disabled -Recurse | % { Rename-Item -Path $_.PSPath -NewName $_.Name.replace(".disabled","")}
      Dir *.Solr.*.example -Recurse | % { Rename-Item -Path $_.PSPath -NewName $_.Name.replace(".example","")}
Batch file for easy use: