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.
- Go to the SOLR folder (in my case: D:\SOLR\solr-7.7.2\solr-7.7.2)
- Go to solr folder under server folder (D:\SOLR\solr-7.7.2\solr-7.7.2\server\solr)
- Copy & Paste the Web index folder (in my case: Sitecore92Testing_web_index) & rename it as a custom index as highlighted in below screenshot.
- Open the folder and edit the core.properties file. Update the name from web index to custom index.
- 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.
- Open Run (Win + R), type services.msc & click OK.
- Go to SOLR service and restart it.
- Once the restart is successful, the new custom index core will get reflected in our SOLR instance.
- We are done with creating custom index. Now we need to integrate it in our Sitecore instance.
- Go to your Sitecore instance’s Content Search config folder (in my case: C:\inetpub\wwwroot\SitecoreDemo.dev.local\App_Config\Sitecore\ContentSearch).
- Copy & Paste the Sitecore.ContentSearch.Solr.Index.Web.config file and rename it as “Sitecore.ContentSearch.Solr.Index.Custom.config”.
- Open the file in Notepad++, and edit the below highlighted values
- Once the above changes are done, Save the file and recycle the app-pool of your sitecore instance.
- 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.
- Login to the sitecore instance and go to Control panel.
- Click on the indexing manager under Indexing section.
- Unselect all other indexes & select only custom index. Click on Rebuild button.
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.. 🙂
One thought on “How to create a custom SOLR index”
Pingback: Error while rebuilding Solr Index: This IndexWriter is closed – Sitecore Competencies