Sitecore Upgrades Mixed with Solr

Monday, March 21, 2016 @ 02:30

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

  1. 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
  2. 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
  3. Starting with 7.0 Initial (IR), the only Solr related assemblies you should have are
    1. AutofacContrib.SolrNet.dll
    2. Castle.Facilities.SolrNetIntegration.dll
    3. Microsoft.Practices.ServiceLocation.dll
    4. Ninject.Integration.SolrNet.dll
    5. Sitecore.ContentSearch.Linq.Solr.dll
    6. Sitecore.ContentSearch.SolrProvider.AutoFacIntegration.dll
    7. Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll
    8. Sitecore.ContentSearch.SolrProvider.dll
    9. Sitecore.ContentSearch.SolrProvider.NinjectIntegration.dll
    10. Sitecore.ContentSearch.SolrProvider.StructureMapIntegration.dll
    11. Sitecore.ContentSearch.SolrProvider.UnityIntegration.dll
    12. SolrNet.dll
    13. StructureMap.SolrNetIntegration.dll
    14. 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.

  1. 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
  2. The following table shows the different configuration files you will need to manage and be aware of as you move through your upgrade process
    1. When moving into Sitecore 8.0 or 8.1, you will need to manually delete 'Sitecore.ContentSearch.Solr.Indexes.config'
    2. 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
  3. 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
    1. Pre 7.2 is
      <configuration type="Sitecore.ContentSearch.SolrProvider.SolrSearchConfiguration, Sitecore.ContentSearch.SolrProvider">
    2. Post 7.2 is
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
Sitecore 7.0 IR+
Sitecore 7.1 IR+
Sitecore 7.2 IR+
Sitecore 7.5 IR+ Sitecore 8.0 IR+
Sitecore 8.1 IR+
Sitecore.ContentSearch.config Sitecore.ContentSearch.config Sitecore.ContentSearch.config
Sitecore.ContentSearch.VerboseLogging.config Sitecore.ContentSearch.VerboseLogging.config Sitecore.ContentSearch.VerboseLogging.config
Sitecore.ContentSearch.Solr.Indexes.config Sitecore.ContentSearch.Solr.Indexes.config ----Delete for this Version----
-----Does Not Apply----- Sitecore.ContentSearch.Solr.Indexes.Analytics.config ----Name Change Occurs-----
----Delete for this Version----
-----Does Not Apply----- Sitecore.ContentSearch.Analytics.config Sitecore.ContentSearch.Analytics.config
-----Does Not Apply----- Sitecore.ContentSearch.DefaultConfigurations.config Sitecore.ContentSearch.DefaultConfigurations.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentSearch.Solr.Index.Analytics.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentSearch.Solr.Index.Core.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentSearch.Solr.Index.Master.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentSearch.Solr.Index.Web.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ContentTesting.Solr.IndexConfiguration.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.FXM.Solr.Index.DomainsSearch.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ListManagement.Solr.Index.List.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.ListManagement.Solr.IndexConfiguration.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Social.Solr.Index.Master.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Social.Solr.Index.Web.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Social.Solr.IndexConfiguration.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Solr.Index.Master.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Solr.Index.Web.config
-----Does Not Apply----- -----Does Not Apply----- Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Solr.IndexConfiguration.config

 

Added Cores

  1. 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
  2. Sitecore 7.5 introduces a new index 'sitecore_solr_analytics_index' that also configured to use a core named 'itembuckets'
  3. Starting with Sitecore 8.0 Initial Release two things happens
    1. First, Sitecore stops defaulting to 'itembuckets' for the core name and now uses the index's name via the $(id) token
      1. sitecore_marketing_asset_index_web
      2. sitecore_marketing_asset_index_master
      3. social_messages_web
      4. social_messages_master
      5. sitecore_list_index
      6. sitecore_fxm_master_index
      7. sitecore_fxm_web_index
      8. sitecore_suggested_test_index
      9. sitecore_testing_index
      10. sitecore_analytics_index
      11. sitecore_core_index
      12. sitecore_web_index
      13. sitecore_master_index
  4. 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]
  5. 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.]
  6. 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:

[NULLREFERENCEEXCEPTION: OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT.]
SOLRNET.SCHEMA.SOLRSCHEMAPARSER.PARSE(XDOCUMENT SOLRSCHEMAXML) +425
SOLRNET.IMPL.SOLRBASICSERVER`1.GETSCHEMA() +207
SITECORE.CONTENTSEARCH.SOLRPROVIDER.SOLRSEARCHINDEX.INITIALIZE() +1125
SITECORE.CONTENTSEARCH.SOLRPROVIDER.SOLRCONTENTSEARCHMANAGER.INITIALIZE() +168 SITECORE.CONTENTSEARCH.SOLRPROVIDER.CASTLEWINDSORINTEGRATION.WINDSORSOLRSTARTUP.INITIALIZE() +757

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

As always, feel free to tweet me questions or comments @thecodeattic or on Sitecore Slack Community as @gillissm.

 

 

Scott Gillis, Lead Consultant at Paragon and 2017 Sitecore MVP, has been working with Sitecore for several years. He has a deep passion for helping clients leverage their content and data into powerful new capabilities in Sitecore and has produced successful outcomes as the technical lead on numerous, complex implementations. Recently, Scott has been focusing on helping these clients take advantage of the wealth of data collected by Sitecore Experience Analytics.