Tuesday, April 12, 2016

Step by step guide for setting up solr 5.x in Sitecore

Getting Started

1. Installing the Solr
You will need the Java Runtime Environment (JRE) version 1.7 or higher. At a command line, check your Java version like this: $ java -version java version "1.8.0_60".

Below are the different ways of installing the solr for Sitecore
1.      Using Bitnami
2.      By following the instructions from Solr reference guide/Github.
3.      Through the Docker for windows

Through Bitnami :
1.      Go the following URL https://bitnami.com/stack/solr & download the “bitnami-solr-5.5.0-1-windows-installer.exe”.
2.      Run “bitnami-solr-5.5.0-1-windows-installer.exe” which will install solr
3.      Open the Solr admin interface by typing localhost://portno/solr (ex- http://localhost:8983/solr/#/)  in the url bar of your browser.

Now you have installed solr and the next step is to configure solr for Sitecore

2. Configure Solr
 1. Go to the path (path where you installed Bitnami) “C:\Bitnami\solr-5.5.0-1\apache- solr\solr\configsets” copy “basic_configs” folder and it paste outside the “configsets” folder i.e. C:\Bitnami\solr-5.5.0-1\apache-solr\solr\ and rename it to index name u are setting up. See the below screen shot for the same.
      

2. Next step is going to solr admin interface and create a core.

3. Generate the schema.xml file using Sitecore CMS I.e. going to Control panel in Sitecore àIndexing à Generate the Solr Schema.xml file
   
4. Copy the generated schema.xml from target location to the Sitecore website root folder.

5. Download the solr support package from https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/Sitecore_81/Sitecore_Experience_Platform_81_Update2.aspx , you can find it in the Additional Tool section.

6. The support package contains most commonly used five IOC containers such as Castle Windsor, AutoFac, Ninject, StructureMap, Unity. We need choose suitable IOC container. In this blog post I have choosen Castle Windsor Container.

7. Copy the following dll to the bin folder of Sitecore website root from the support package.

      

8. By default Sitecore uses lucene search for its search functionality. So we need disable all the lucene related config files to enable solr search functionality. In my case I’ve already disable the lucene related config files. Please refer the below screen shot.
  To Disable .config file , rename file from .config to .example/.disabled.


For Sitecore XP 8.1 you need disable/enable some extra config files. Below is the list of the config file that you need enable/disable.

Enabled the following configs:
"App_Config\Include\Sitecore.MarketingReportingRole.config",
"App_Config\Include\Sitecore.PipelineProfiling.config",
"App_Config\Include\Sitecore.Xdb.Remote.Server.config",
"App_Config\Include\Sitecore.Xdb.Remote.Server.MarketingAssets.config",
"App_Config\Include\Sitecore.PathAnalyzer.Services.RemoteServer.config",
"App_Config\Include\Sitecore.MarketingProcessingRole.config",
"App_Config\Include\Sitecore.PipelineProfiling.config",
"App_Config\Include\CES\Sitecore.CES.DeviceDetection.CheckInitialization.config",
"App_Config\Include\Sitecore.ContentSearch.Analytics.config"
"App_Config\Include\Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config",
"App_Config\Include\Sitecore.ContentSearch.Solr.Index.Analytics.config",
"App_Config\Include\ContentTesting\Sitecore.ContentTesting.Solr.IndexConfiguration.config"
Disabled the following configs:

"App_Config\Include\ContentTesting\Sitecore.ContentTesting.Lucene.IndexConfiguration.config",
"App_Config\Include\Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config"
"App_Config\Include\Sitecore.ContentSearch.Lucene.Index.Analytics.config",
"App_Config\Include\Sitecore.ContentSearch.Lucene.Index.Core.config",
"App_Config\Include\Sitecore.ContentSearch.Lucene.Index.Master.config",
"App_Config\Include\Sitecore.ContentSearch.Lucene.Index.Web.config"
"App_Config\Include\Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Lucene.Index.Master.config",
"App_Config\Include\Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Lucene.Index.Web.config",
"App_Config\Include\Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Lucene.IndexConfiguration.config",
"App_Config\Include\Sitecore.Marketing.Lucene.Index.Master.config",
"App_Config\Include\Sitecore.Marketing.Lucene.Index.Web.config",
"App_Config\Include\Sitecore.Marketing.Lucene.IndexConfiguration.config",
"App_Config\Include\FXM\Sitecore.FXM.Lucene.DomainsSearch.DefaultIndexConfiguration.config",
"App_Config\Include\FXM\Sitecore.FXM.Lucene.DomainsSearch.Index.Master.config",
"App_Config\Include\FXM\Sitecore.FXM.Lucene.DomainsSearch.Index.Web.config",
"App_Config\Include\ListManagement\Sitecore.ListManagement.Lucene.Index.List.config",
"App_Config\Include\ListManagement\Sitecore.ListManagement.Lucene.IndexConfiguration.config",
"App_Config\Include\Social\Sitecore.Social.Lucene.Index.Master.config",
"App_Config\Include\Social\Sitecore.Social.Lucene.Index.Web.config",
"App_Config\Include\Social\Sitecore.Social.Lucene.IndexConfiguration.config"

9. It is also necessary to download the Castle.Core and Castle.Windsor dlls from
and https://www.nuget.org/api/v2/package/castle.core/3.1.0 Extract both the package & copy the dll from “lib\net40-client” and paste it in the bin folder of Sitecore website.

10. Make the following changes in the global.asax file
<%@ Application Language='C#' Inherits="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication" %>

11. To check whether solr is properly configured or not, browse the solr admin interface & Sitecore instance. You should be able to browse your website without any error.

Reference

No comments:

Post a Comment