How to create a custom SOLR index

There are few default indexes which are created by Sitecore for the internal use. We can use 2 of it’s default indexes namely sitecore_web_index & sitecore_master_index to build our Site search functionality or search based components.

In case you have only one site developed in Sitecore instance with very few pages and content then you can go for default indexes. But in case of multi sites or large corporate sites, you need to create a custom index specific to your site (which will include only content items below your site node).

So lets see how to create a custom SOLR index.

  1. Go to the SOLR folder (in my case: D:\SOLR\solr-7.7.2\solr-7.7.2)
    SOLR_Folder
  2. Go to solr folder under server folder (D:\SOLR\solr-7.7.2\solr-7.7.2\server\solr)
  3. Copy & Paste the Web index folder (in my case: Sitecore92Testing_web_index) & rename it as a custom index as highlighted in below screenshot.
    SOLR_CustomIndex_Folder
  4. Open the folder and edit the core.properties file. Update the name from web index to custom index.
    coreproperties_File
  5. We are done creating the custom index in SOLR folder. To reflect this changes in our SOLR search, we will need to restart our solr services.
  6. Open Run (Win + R), type services.msc & click OK.
  7. Go to SOLR service and restart it.
    SOLR_Service
  8. Once the restart is successful, the new custom index core will get reflected in our SOLR instance.
  9. We are done with creating custom index. Now we need to integrate it in our Sitecore instance.
  10. Go to your Sitecore instance’s Content Search config folder (in my case: C:\inetpub\wwwroot\SitecoreDemo.dev.local\App_Config\Sitecore\ContentSearch).
  11. Copy & Paste the Sitecore.ContentSearch.Solr.Index.Web.config file and rename it as “Sitecore.ContentSearch.Solr.Index.Custom.config”.
    ContentSearch_Folder
  12. Open the file in Notepad++, and edit the below highlighted values
    Core_Config
  13. Once the above changes are done, Save the file and recycle the app-pool of your sitecore instance.
  14. We are done with creating Custom index and integrating it with Sitecore instance, we now need to rebuild it once so that only specific items will be indexed in it.
  15. Login to the sitecore instance and go to Control panel.
    Launchpad
  16. Click on the indexing manager under Indexing section.
    Indexing_Manager
  17. Unselect all other indexes & select only custom index. Click on Rebuild button.
    Indexing_Success

We are done with creating the custom SOLR index and integrating it with the Sitecore instance. Now you can use it in a same way as we use the default index.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s