Hello, Sitecore enthusiasts! This is the second article of Sitecore 8.2 with Solr 6.2 blog series.
Configuring Solr to use with Sitecore
Generate an XML Schema for Solr
Solr needs a defined XML schema when working with documents. Follow below steps to generate Solr Schema XML file:
- Duplicate basic_configs folder under C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets and rename duplicated folder as sitecore_configs.
- Verify that that you have a file named schema.xml under the C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs\conf folder. If you don't have a schema.xml file under the folder then you will need to perform below extra steps, as explained in solution 2 of the Solr Compatibility Table:
- Create schema.xml file by duplicating and renaming the managed-schema file present in C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs\conf folder
- Switch to ClassicIndexSchemaFactory by adding the following line in the end to the SolrConfig.xml file present in C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs\conf folder:
<schemaFactory class="ClassicIndexSchemaFactory" />
- Open schema.xml file and make the following changes:
- Enclose all <field> and <dynamicField> elements in a <fields> tag.
- Enclose all <fieldType> elements in a <types> tag.
- Save schema.xml and also create a backup file of schema.xml.
- Log into your Sitecore instance.
- Navigate to Sitecore Control Panel.
- In the Control Panel, click Generate the Solr Schema.xml file link in Index section.
- In the dialog window, change the source file and target file to point to the newly created schema file (C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs\conf\schema.xml) and click the ‘Generate’ button.
- Sitecore will create a modified schema.xml file, using the schema.xml file we created as a baseline in above steps and add all its necessary Solr specific fields needed for indexing, unique keys etc.
- Open the newly generated schema file (C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs\conf\schema.xml) and add below line:
<fieldType name="pint" class="solr.TrieIntField" docValues="true" precisionStep="0" positionIncrementGap="0" />
Organize Solr core structure
- Copy the sitecore_configs (C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr\configsets\sitecore_configs) folder and paste it in C:\Bitnami\solr-6.2.1-2\apache-solr\server\solr. Rename it to the sitecore_web_index.
- For each Sitecore index, we need to repeat above step 1 until we have a set of config directories with the following names:
- sitecore_web_index
- sitecore_master_index
- sitecore_core_index
- sitecore_analytics_index
- social_messages_web
- social_messages_master
- sitecore_marketing_asset_index_master
- sitecore_marketing_asset_index_web
- sitecore_testing_index
- sitecore_suggested_test_index
- sitecore_fxm_master_index
- sitecore_fxm_web_index
- sitecore_list_index
- sitecore_marketingdefinitions_master
- sitecore_marketingdefinitions_web
- Once you have configured all the directories, navigate to the Solr admin page.
- After login, navigate to Core Admin page and click on Add Core button.
- Fill in the 'name' and 'instanceDir' fields with sitecore_web_index, and press the "Add Core" button to add the core into Solr.
- You should be able to see that sitecore_web_index core is now present in the list of cores available in your Solr instance.
- Repeat these steps for all directories created earlier so that we'll have a Solr core for each directory we created.
0 comments :
Post a Comment