10

I am trying to configure Solr for Sitecore 8.2. Solr is running and I have cores set up for each index and secondary cores set up for rebuilding. I'm not using the Solr support package.

I am getting the following error when trying to browse the site:

Could not create instance of type: Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex. No matching constructor was found.

I'm guessing, it's a configuration problem. However, I can't get to showconfig.aspx to see what the issue might be.

Below is the patch config for the indexes:

<indexes>
  <index id="sitecore_core_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_core</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_core_2</param>
  </index>
  <index id="sitecore_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_master</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_master_2</param>
  </index>
  <index id="sitecore_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_web</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_web_2</param>
  </index>
  <index id="sitecore_marketing_asset_index_master" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_marketing_asset_master</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_marketing_asset_master_2</param>
  </index>
  <index id="sitecore_marketing_asset_index_web" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_marketing_asset_web</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_marketing_asset_web_2</param>
  </index>
  <index id="sitecore_marketingdefinitions_master" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_sitecore_marketingdefinitions_master</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_sitecore_marketingdefinitions_master_2</param>
  </index>
  <index id="sitecore_marketingdefinitions_web" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_sitecore_marketingdefinitions_web</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_sitecore_marketingdefinitions_web_2</param>
  </index>
  <index id="sitecore_testing_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_testing</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_testing_2</param>
  </index>
  <index id="sitecore_suggested_test_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_suggested_test</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_suggested_test_2</param>
  </index>
  <index id="sitecore_fxm_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_fxm_master</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_fxm_master_2</param>
  </index>
  <index id="sitecore_fxm_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_fxm_web</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_fxm_web_2</param>
  </index>
  <index id="sitecore_list_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_list</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_list_2</param>
  </index>
  <index id="social_messages_master" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_social_messages_master</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_social_messages_master_2</param>
  </index>
  <index id="social_messages_web" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_social_messages_web</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_social_messages_web_2</param>
  </index>
</indexes>
1
  • Thanks to all. I have tried the below configuration to rebuild my index. No errors .It worked as expected. Please remove the Patch after and refer my configuration in comments.
    – Raghav
    Commented Jun 20, 2017 at 15:51

2 Answers 2

9

I had exactly the same issue as you and for me it was a really small change to the patching that fixed it:

Instead of:

<index id="sitecore_core_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_core</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_core_2</param>
</index>

Do this:

<index id="sitecore_core_index">
    <patch:attribute name="type" value="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider"/>
    <param desc="core">SitecoreSandbox_core</param>
    <param patch:after="*[@desc='core']" desc="rebuildcore">SitecoreSandbox_core_2</param>
</index>

notice that in the first line <index id=..... I removed the type attribute. Its a strange thing, but that fixed it when I tried.

2
  • 1
    that's weird, the config in question works fine for me in 8.1 and 8.2 with or without the "type". Commented Oct 3, 2016 at 21:30
  • unfortunately that did not fix it. I must have something else going on. Commented Oct 3, 2016 at 21:34
6

It turns out there were 2 issues I was having:

  1. Because I was customizing the core names I needed to include a node for sitecore_analytics_index. Based on this blog post I had left the node out thinking it wasn't needed.
  2. Patch config order. My include file was getting patched too soon so the correct core names were not getting used.
1
  • Fixing the patch config order fixed it for me. <param desc="rebuildcore" patch:after="param[@desc='core']">$(id)_rebuild</param> Commented Sep 7, 2017 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.