Sitecore Indexes not Loading

Sitecore 9

Symptoms

When you install Coveo for Sitecore in a scaled environment, you need to deploy Sitecore on the content delivery servers. This process requires four steps.

  1. Copying the Package to CDs

  2. Copying the Coveo Data Directory

  3. Copying the Configuration Files

  4. Enabling SwitchMastertoWeb

To read the detailed steps, see Deploying Sitecore on the Content Delivery Servers. Step four aims to place the SwitchMasterToWeb.config file into a subfolder with prefix Z to make sure that its files are processed at the very end of the load process. However, you may face issues where the search indexes are still present in the output of the /sitecore/admin/showconfig.aspx page (they ).

When hitting a search-driven page, you get one of the following error messages:

[ArgumentNullException: Precondition failed: The parameter 'p_Index' must not be null
Parameter name: p_Index]
   Coveo.Framework.CNL.Precondition.NotNull(Object p_Parameter, String p_ParameterName) +308
   Coveo.Framework.CNL.Precondition.NotNull(Object p_Parameter, Func`1 p_ParameterExpression) +110
   Coveo.AbstractLayer.FieldManagement.FieldsHandlerUtilityFactory.CreateFieldsHandlerUtility(ISearchIndex p_Index) +220
   Coveo.UI.Mvc.Models.BaseModelConfiguration..ctor(IRendering p_Rendering, IFieldHelper p_FieldHelper, IParametersHelper p_ParametersHelper, ILocalizedStringFetcher p_LocalizedStringFetcher, ILicenseManager p_LicenseManager, IAnalyticsModel p_AnalyticsModel, ISitecoreContext p_SitecoreContext, IRulesHelper p_RulesHelper, ICoveoIndexConfigurationFactory p_ConfigurationFactory, ICoveoIndexFetcher p_CoveoIndexFetcher, IFieldsHandlerUtilityFactory p_FieldsHandlerUtilityFactory) +2060
   Coveo.UI.Mvc.Models.BaseModel.InitializeHelpers(IRendering p_Rendering) +834
   Coveo.UI.Mvc.Models.SearchBaseModel.InitializeHelpers(IRendering p_Rendering) +75
   Coveo.UI.Mvc.Models.BaseModel.Initialize(Rendering p_Rendering) +400
   Sitecore.Mvc.Pipelines.Response.GetModel.InitializeModel.Initialize(Object model, Rendering rendering, GetModelArgs args) +108
   Sitecore.Mvc.Pipelines.Response.GetModel.InitializeModel.Process(GetModelArgs args) +155
...

The parameter 'p_Index' must not be null issue hides another error, therefore displaying a second error message:

Exception: System.InvalidOperationException
Message: Could not find configuration node: contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.IsTrue(Boolean condition, String message)
   at Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert)
   ...
   at Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration()
   at Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name)
   at Sitecore.ListManagement.ContentSearch.Pipelines.GetAllLists.GetAllContactLists..ctor(

Cause

This issue occurs because of some config files in the /App_Config/Include folder that are applied after the SwitchMasterToWeb.config file, therefore reverting the configuration changes made by the SwitchMasterToWeb.config file. In further updates, Coveo for Sitecore will display error message Unable to load Sitecore indexes to announce the issue, and therefore ease the resolution process.

Resolution

You’ll enable files SwitchMastertoWeb.config.example and SwitchMastertoWeb.Coveo.config.example in Sitecore by moving them to subfolder Z.SwitchMastertoWeb. All indexes should then be correctly disabled.

Ensure that the SwitchMasterToWeb.config file is applied as the latest one in the list of configuration changes.

For example, follow the steps below:

  1. Create a sub-directory in the /App_Config/Include folder that’s the latest one alphabetically comparing to other sub-folders (e.g., Z_SwitchMasterToWeb).

  2. Move the SwitchMasterToWeb.config file to that folder.

Recommended Articles