Solr - Error When Initializing Coveo When Side-by-Side With Solr Is Enabled

In this article

Symptoms

  • The Sitecore site goes down when enabling Solr.

  • The generated stack trace shows that the error occurs when Coveo is trying to validate the Coveo Index configuration:

    [...]
    Sitecore.Sites.SiteContextFactory.GetSiteContext(String name) +38
    Coveo.Framework.Sites.SiteContextFactoryWrapper.GetSiteContext(String p_SiteName) +127
    Coveo.Framework.Configuration.CoveoIndexConfiguration.Validate() +165
    Coveo.SearchProvider.ProviderIndexBase.Initialize(IIndexDocumentPropertyMapper`1 p_DocumentTypeMapper) +2241

Cause

Due to how Solr dependencies are injected into Sitecore, Coveo tries to validate its configuration before the site context is initialized.

Resolution

Set the skipSiteNameValidation flag to true in the Coveo.SearchProvider.Custom.config configuration file.

<sitecore>
  <coveo>
    <defaultIndexConfiguration>
      <skipSiteNameValidation>true</skipSiteNameValidation>
    </defaultIndexConfiguration>
  </coveo>
</sitecore>