SXA search operations might fail with an unhandled exception on a CD instance. The following message can be found in the logs:
Exception: System.NullReferenceException Message: Object reference not set to an instance of an object. Source: Sitecore.ContentSearch at Sitecore.ContentSearch.Utilities.QueryBuilder.CreateQuery[T](IProviderSearchContext context, IEnumerable`1 searchStringModel) at Sitecore.XA.Foundation.Search.Services.SearchService.GetQuery(SearchQueryModel searchQueryModel, String& indexName) at Sitecore.XA.Feature.Search.Controllers.SearchController.GetResults(QueryModel model)
or
Exception: System.ArgumentNullException Message: Value cannot be null. Parameter name: objectToSwitchTo Source: Sitecore.Kernel at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) at Sitecore.Common.Switcher`2.Enter(TValue objectToSwitchTo) at Sitecore.XA.Foundation.Search.Services.SearchService.GetQuery(SearchQueryModel searchQueryModel, String& indexName) at Sitecore.XA.Feature.Search.Controllers.SearchController.GetResults(QueryModel model)
The issue occurs because the shell site is used as a context site for SXA search.
To resolve the issue, download and install the latest cumulative hotfix compatible with the affected product version: