Configuring Solr for use with Sitecore 8
This is a work in progress!
The purpose of this document is to illustrate the steps needed to get SOLR configured properly for use with a Sitecore 8 instance.
If you are looking for a very short guide, please check our fast track for lazy developers. Currently it has everything ready for Solr 4.10 on Sitecore 8.1.
Step 1: Install SOLR via Bitnami as described here.
Step 2: To save time, create a custom SOLR configset by copying, pasting and renaming the basic_configs folder (found, for instance, in C:\Bitnami\solr-5.2.1-0\apache-solr\solr\configsets) to create a new one named sitecore_configs like this:
Step 3: Please see 2 notes below before you go to the KB link! Perform the steps described in this KB article for “schema.xml” in sitecore_configs folder.
NOTE: For SOLR 5.x “pint” fieldType definition should look like this:
<fieldType name="pint" class="solr.TrieIntField"/>
NOTE: For some newer Sitecore versions dynamicField “pint” is already changed to “tint”, check the generated schema for
<dynamicField name="*_pi" type="tint" indexed="true" stored="true" />
Step 4: Copy the sitecore_configs (C:\Bitnami\solr-5.2.1-0\apache-solr\solr\configsets\sitecore_configs) folder and paste it in C:\Bitnami\solr-5.2.1-0\apache-solr\solr. Rename it to the index you are setting up, which, for this exercise, use sitecore_analytics_index.
Step 5: Pass the schema.xml file from C:\Bitnami\solr-5.2.1-0\apache-solr\solr\sitecore_analytics_index\conf to the Sitecore SOLR Schema Generator (Control Panel > Indexing > Generate the SOLR Schema.xml file). >NOTE: You should be able to use the same file for both source and target but it for some reason you have errors then copy schema.xml to schema-orig.xml and use that as your source).
Optional Development Step
Fix following lines in the file “schema.xml” (that were added to “schema.xml” by schema generator):
When done they should look like these:
In summary, replace all type properties so they say text_general.
NOTE: This is just for testing purposes, for real project definitions of appropriate language-specific field types (for example “text_de”) have to be added according to SOLR documentation.
Step 6: Navigate to the SOLR admin page or by pressing Go to application in Bitnami tool:
Step 7: Go to Core admin, press Add core and fill name and instance dir with the name of the index being added (from Step 4 above), in this example use sitecore_analytics_index.
Step 8: Download SOLR Support Package from your update of Sitecore 8. Unpack the package and copy all dlls from bin folder to your Sitecore bin folder.
Step 9: If you don’t have the Microsoft.Practices.Unity.dll in your bin folder, download and install Unity and the needed dll will be in C:\Program Files (x86)\Microsoft Unity Application Block 2.1\Bin.
Step 10: In the App_Config/Include folder ensure that the following files have been disabled or enabled depending on their purpose.
Generally speaking, any config file with the Lucene text in it should be disabled and any config file with Solr text in it should be enabled.
Step 11: Change next settings in Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config:
<setting name="ContentSearch.Solr.ServiceBaseAddress" value="http://localhost:9999/solr" />- set port accordingly
<setting name="ContentSearch.Solr.EnableHttpCache" value="false" />- set to false
Step 13: Now you need to convert the application to use
Castle.WindsorApplication in the Global.asax. Do this by editing the Global.asax file as follows:
NOTE: If you get an index has no configuration exception after starting the site, check your config patch files for Lucene indexes that are missing the
<configuration /> element. When you enable SOLR it becomes the default provider and that causes this exception on existing Lucene indexes that don’t have the provider explicitly configured.
Another option is to use Unity integration:
<%@Application Language=’C#’ Inherits=”Sitecore.ContentSearch.SolrProvider.UnityIntegration.UnityApplication” %>
Check it out, if Castle.Windsor doesn’t work for you for some reasons.
Verify it works
To check if anything is getting into your index, make some completed visits to the website (followed by session end) and run this query in the browser:
For other indexes, for example “sitecore_master_index”, just rebuild index (using standard application in Control Panel -> Indexing Manager) and request similar url:
Rinse and repeat
Use the process detailed in Steps 4-7 to create new cores for all the remaining indexes you would like to move to SOLR.