Thursday, 13 August 2015

Setup Solr Search Provider for Sitecore



In this blog we will talk about how to use solr as a search provider for sitecore search; As you know the default search provider for sitecore is Lucene.



First thing you need to do is to configure a new solr instance that will be used by sitecore, and you can do that by installing  a setup from solr installer which is a ready installer for different OS and you can select the setup that suite your OS. The following are screenshots of the solr manager tool that will be installed when you run the above setup:


If you click on Go To application on the above screen you will open new browser with the Url like "http://localhost:8888/solr/", As for the port number it is configured; you can change it by switching to the other tab "Manage Servers" in the solr manager tool and then select the server and by clicking configure you can change the default port. and the following is screen shot of the web:




You can now configure a solr core that will be used by your sitecore solr indexes by doing the following:
  1. Browse to "Bitnami\solr-4.10.2-0\apache-solr\solr" at your local disk.
  2. Make a copy of the folder "Collection1" and rename the folder .
  3. Open file "core.properties" and rename the value inside it with your new core name 'name=newcorename'.
  4. Now you can see your new core as you can see in the following screen shot:

 Now we are done with solr installation and configuration lets go to sitecore and setup our solr provider. Follow the steps below :
     
1.       Take a backup from your site.
2.       Remove all the Lucene dlls and configuration files from your site
3.       Go to sitecore website and install the correct package for solr support in my case I will use " Sitecore.Solr.Support 1.0.0 rev. 141215", In which you will find:
a.       DLLs  in bin folder that need to be copied to your site bin.
b.      Configuration file that should be copied to your include folder.
4.       The configuration file "Sitecore.ContentSearch.Solr.Indexes.config" should be updated as following:
a.       Search for "ContentSearch.Solr.ServiceBaseAddress" setting and update the value of the solr instance URL "http://localhost:8888/solr".
b.      Update the core value of your indexes (sitecore_master_index, sitecore_web_index, sitecore_core_index)in the configuration file with the core name you created when we configured solr "newcorename".


  Now we need to generate the schema.xml file for solr and to do this follow the steps below:
    
1.       Create new text file with .xml extension and add the following xml structure inside:

 <schema name=" newcorename " version="1.5">
     <fields>
                   <field />
   </fields>
   <types>
                   <fieldType />
   </types>
    
2.       Now go sitecore --> control panel --> Indexing --> Generate the Solr Schema.xml file
3.       As you can see in the following screen shot you will provide the file you created in the previous steps in the source file and another new path in the target file and click generate.



4.       You will have a new generated XML file contains sitecore fields and types.
5.       Copy this file to "Bitnami\solr-4.10.2-0\apache-solr\solr\ newcorename \conf".
             
After finishing all the steps above go to indexing in sitecore and rebuild your indexes if the indexes have been rebuilt successfully then you configured the solr correctly!.

2 comments:

Anonymous said...

please reply in sitecore community forum https://community.sitecore.net/developers/f/5/t/3104 if possible Thanks

Anonymous said...

Replied! Hope it help.

Post a Comment