I'm currently experiencing an issue in SXA where the log reports an error and no search results are returned.

3764 08:00:38 WARN  Results endpoint exception
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)

This appears to work fine in both Standalone and ContentManagement roles.


This is an interesting issue and is somewhat related to another problem with the Asset Optimizer. In the ContentDelivery role SXA makes use of the "shell" site. When this is set to "core" the optimizer breaks. If you remove it then it creates an issue with search.

Below is a patch I got working to support both features:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="ContentDelivery">
      <site name="shell" set:database="web" />
      <site name="modules_shell" set:database="web" />
      <site name="login">
        <patch:delete />

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.