Sitecore Upgrades Mixed with Solr

Monday, March 21, 2016

Sitecore Upgrades Mixed with Solr

By: Scott Gillis, Lead Consultant – I've recently seen an uptick in Sitecore upgrades that have implemented Solr as their search provider. Most of these upgrades are coming from a version of 7.x moving to the latest 8.x version. This posts enumerates a few of the differences you need to be aware of as you move through the upgrade process when dealing with Solr. Since my upgrades, as of late, have not been moving from 6.x into anything, I won't be listing helpful advice regarding practices for rewriting all of your search code, which would be required.

Updated Assemblies

Assemblies are updated not from the Sitecore update package, but are copied in from a Sitecore Solr Support archive that must be downloaded separately from the main update package and files

In most instances, the date stamp on these Solr Support archives are within a day, plus or minus, of the release date stamp on the Sitecore version

Starting with 7.0 Initial (IR), the only Solr related assemblies you should have are

AutofacContrib.SolrNet.dll

Castle.Facilities.SolrNetIntegration.dll

Microsoft.Practices.ServiceLocation.dll

Ninject.Integration.SolrNet.dll

Sitecore.ContentSearch.Linq.Solr.dll

Sitecore.ContentSearch.SolrProvider.AutoFacIntegration.dll

Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll

Sitecore.ContentSearch.SolrProvider.dll

Sitecore.ContentSearch.SolrProvider.NinjectIntegration.dll

Sitecore.ContentSearch.SolrProvider.StructureMapIntegration.dll

Sitecore.ContentSearch.SolrProvider.UnityIntegration.dll

SolrNet.dll

StructureMap.SolrNetIntegration.dll

Unity.SolrNetIntegration.dll

Configuration File Renamed

Another major change is the renaming and addition of new Solr related configuration files. In my upgrades, this caused the most headaches for us, as there was a naming convention change that wasn't fully documented that caused our instances to try and incorrectly load types.

Solr configuration files are included in the Solr Support packages for 7.0, 7.1, 7.2 and 7.5. Starting with 8.0, the configuration files are included as the part of the base Sitecore install

The following table shows the different configuration files you will need to manage and be aware of as you move through your upgrade process

When moving into Sitecore 8.0 or 8.1, you will need to manually delete 'Sitecore.ContentSearch.Solr.Indexes.config'

Depending on the instructions followed for configuring individual indexes, you may need to delete or compare to the new indexing configuration files in Sitecore 8.0 and Sitecore 8.1

If you have custom indexes defined, you will need to update the configuration type, as this has changed namespaces starting in Sitecore 7.2 IR

Added Cores

Most tutorials for configuring Sitecore for Solr have you generate a single core in Solr. Normally this core is called 'itembuckets', and the same core is configured for Web, Master and Core indexes

Sitecore 7.5 introduces a new index 'sitecore_solr_analytics_index' that also configured to use a core named 'itembuckets'

Starting with Sitecore 8.0 Initial Release two things happens

First, Sitecore stops defaulting to 'itembuckets' for the core name and now uses the index's name via the $(id) token

sitecore_marketing_asset_index_web

sitecore_marketing_asset_index_master

social_messages_web

social_messages_master

sitecore_list_index

sitecore_fxm_master_index

sitecore_fxm_web_index

sitecore_suggested_test_index

sitecore_testing_index

sitecore_analytics_index

sitecore_core_index

sitecore_web_index

sitecore_master_index

If the above cores do not exist and you try to login to Sitecore after upgrading to 8.0, you may be faced with the following unhelpful error message:Connection error to search provider [Solr] : Unable to connect to [http://localhost:8983/solr]

To solve this, you either need to create all of the cores listed above or trick Sitecore into using your single existing 'itembuckets' core via the following helpful patch file. Be sure to place this Instead use the following patch file to be placed into your 'z.loadlast' directory in App_Config \ Include. ["The z.what the hell directory?" you ask, take a look at my post How Sitecore Config Files Load.]

The patch file can also be used if you wish to set up a different naming schema without having to touch each base configuration file post upgrade

Schema XML

If part of your upgrade process is to also upgrade to the latest version of Solr or if you are running a version of Solr 4.8 or later, you may experience the following error message:

There is a known issue with the Sitecore schema generator where it cannot properly update the base schema file for these versions. Therefore, after running the schema generator, there are some manual steps that must be taken as documented in the following Sitecore Knowledge Base article https://kb.sitecore.net/articles/227897