A step by step go through of Solr installation and configuration using Bitnami: Versions: Solr 5.2, Sitecore 8.0 (Update 4)

  1. Pre-requisites
  2. Installation
  3. Core Creation
  4. XML Schema – Generation
  5. Sitecore’s Solr DLLS – Addition
  6. Edit Global asax
  7. Rebuild Indexes

 

Pre-requisites

Installation

We can choose out from different approaches for installing Solr viz.

1. By using Bitnami

2. By following the Solr instructions guide (without using Bitnami) and

3. I recently came across this third option through a blog post by Vasiliy Fomichev (https://hub.docker.com/r/vasiliyfomichev/solr-for-sitecore/ )

Well, here in this blog post, we are going to sail through the first approach – the Bitnami way. Let’s start with the Bitnami Apache Solr Stack. This installer facilitates the installation as well as configuration of solr in many ways and thus makes it pretty easy even for a naïve Sitecore technical to get it done.

To start with, double-click on the installer. The installation process will take you through a couple of dialog boxes. The below shown dialog box is the first one to appear:

1

We will click Next. The default installation path is C:\Bitnami\solr-5.2.1-1, which can be altered by you as per your wish or requirement.

2

Now, when we click next, we will be prompted a Screen to provide the port for Apache to run on. Here I would say that if you have chosen to set up Solr for development or if you are installing it locally, please change the default port to anything else, other than 80 (as it is used by IIS). Here, in my case, I have used port 8888.

3

Please click Next. Once the Bitnami installation has been Complete, check the “Launch Bitnami Apache Solr Stack now?” Check box and click Finish.

4

Now, you will view a page opened up in your browser, similar to the one shown below:

5

Now, we will click on the “Access Bitnami Apache Solr” link which will navigate us to Solr dashboard as shown below:

6

 

Here, the installation part is complete. Yes, it is… indeed, in just a few simple steps. Now let’s proceed to the configuration of Solr with Sitecore.

Core Creation

  • Here, we will use the default SOLR configuration. So, we will copy “basic_configs” folder from the path “C:\Bitnami\solr-5.2.1-1\apache-solr\solr\configsets\” and paste it at the path “C:\Bitnami\solr-5.2.1-1\apache-solr\solr\”. Now we will rename the basic_configs folder to “sitecore_web_index”. Please refer the screenshot below:

7

  • Next step is to create core through Solr Core Admin Interface, as depicted through the screenshot below:

XML Schema – Generation

  •  Now, please enclose all <field> and <dynamicField> elements in the <fields> tag.
  • Enclose all <fieldType> elements in the <types> tag.
  • Build Solr Schema Wizard to add the Sitecore specific configuration:
  • First, define the fields to index. This is defined in the “schema.xml” file at C:\Bitnami\solr-5.2.1-1\apache-solr\solr\sitecore_web_index\conf.
  • Rename this file to “schema_orig.xml”.
  1. Generate a new Schema.xml file: Now, we require a new schema.xml file to be generated, so please go to your Sitecore instance:

In the Sitecore Desktop, go to the Control Panel:

9

  1. In indexing section, you will see “Generate the Solr Schema.xml file” option. Click on that.

10

Now, here you need to provide the source and target file to proceed.

  • In source, type in/paste the full path for “schema_orig.xml”.
  • In destination, type in/paste full path for the new “schema.xml”.
  • Then click on Generate.
  • Once the file is generated, please don’t forget to verify the new schema.xml for the below mentioned contents:

It should contain fields such as:      “_ content ” and “_datasource.

<fields>

<field name=”_ content” type=”string” indexed=”true” stored=”true” required=”true” />

<field name=”_ datasource” type=”text_general” indexed=”true” stored=”true” />

  • Now, Reload Solr Core. There are chances that you may encounter errors. For example:

“Unknown fieldType ‘text_es’ specified on field *_t_es“

Don’t worry. We are well prepared with the solution too. To resolve this, we just need to replace “text_*” with “text_general”. Property “type” should be replaced in all such lines to “text_general”. We have done this to resolve the errors from our project which is a sort of test project. But, while working on live projects, we must add – definitions of appropriate language-specific field types (for example “text_es”). So, now the dynami fields in your schema file will change from:

<dynamicField name=”*_t_es” type=”text_es” indexed=”true” stored=”true” />

to…

<dynamicField name=”*_t_es” type=”text_general” indexed=”true” stored=”true” />

  • Field type should be defined in the following way:
    • <fieldType name=”pint” class=”solr.TrieIntField”/>
  • Now go to the SOLR console, select “Core Admin” on the left, and then click on”Reload” on the top which will load the schema changes.

Please Note: The name of the core does not have to be sitecore_web_index. If a different name is given, please ensure that you update the index references in the file Sitecore.ContentSearch.Solr.Index.Web.config.

Sitecore’s Solr DLLS – Addition

  • Although, in this walkthrough we are using Castle Windsor, but AutoFac, Ninject, StructureMap and Unity are also, each with their own DLLS). For Castle Windsor, we need to copy the following files over to the project bin directory:

11

  • It is also necessary to add Castle.Core and Castle.Windsor. We can create a solution and use NuGet, or you can pull them directly from the Nuget site, using https://www.nuget.org/api/v2/package/castle.windsor/3.1.0 and https://Hitting these URLs on Chrome automatically downloads a .nupkg object, nuget.org/api/v2/package/castle.core/3.1.0  which you can rename to a zip archive. Both archives contain a “lib\net40-client” path. Copy Castle.Windsor.dll and Castle.Core.dll from lib\net40-client of each package to the website bin directory.
  • Change Sitecore’s configuration to use the new index. To do so, perform the below listed three steps.
  • First, let’s enable solr config files from the App_Config/Include  directory by removing the suffix “.disables” from the file name. For Example:

Sitecore.ContentS:earch.Solr.DefaultIndexConfiguration.config

Sitecore.ContentSearch.Solr.Index.Web.config

  • Disable all lucene config files from the App_Config/Include directory by adding “.disabled” as a suffix in the file name. For example:

Sitecore.ContentSearch.DefaultConfigurations.config.disabled

  • Now, open “Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config” file and change the default port 8983 to port you have used. In my case it is 8888. So, after adding the port number, it will look as shown below:

<setting name=”ContentSearch.Solr.ServiceBaseAddress” value=”http://localhost:8888/solr” />

Edit Global.asax

Now, wire in the inversion of Control logic by editing the Global.asax “Application” directive to read. This can be achieved by adding the snippet mentioned below:

<%@Application Language=’C#’ Inherits=”Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication”%>

Rebuild Indexes

In this document we have covered the creation of web index. Similarly, we can create the other indexes too. Now, final step is to Go to Control Panel\Indexing\Indexing Manager, and rebuild the Core, Master, and Web Indexes. Now, your search must fetch the desired results.

3 thoughts on “A step by step go through of Solr installation and configuration using Bitnami: Versions: Solr 5.2, Sitecore 8.0 (Update 4)

  1. I wanted to thank you for this amazing read!! I undoubtedly appreciating every little touch of it I
    have you bookmarked to take a look at new stuff you post.

  2. Greetings! Really helpful guidance on this article!
    It truly is the little changes that make the biggest changes.
    Thanks a lot for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>