One of the things I recently ran into was what should you do if you have multiple projects with the same SOLR index name. SOLR does not allow you to have the same name for an index. For instance you can’t have more than one sitecore_master_index. You will be warned and unable to if you try and create one with the same name. Also if you rebuild the indexes it will overwrite the index data for the other site you were working on. So I went on Sitecore Slack looking for help. Where Sitecorey gave me a great idea. Basically you would prefix the configuration entry core with the name of the site in each index file. See below for an example.
Your index name should reflect that name as well in the SOLR index directory.
Now this did solve the issue of having multiple indexes, but a few people on the team wanted to take it a step further. They wanted to see indexes prefixed with site name from the control panel index rebuild. So I created a config transform this time for it. Keep in mind this is always a smart idea to keep the original files safe. Basically I just replaced the id value.
From my understanding the SIM installer can also help with the prefixing of index names. I haven’t used it for that yet as my site was already installed, but in the future that is something I will consider. Let me know if you have any questions.
2 thoughts on “Keeping #Sitecore #SOLR Index Names Unique for Multiple Projects”
Core names are also replaced to make them unique when you install with SIF in Sitecore 9
I’d also suggest using a “sc.variable” and replacing the token with “$(instance)_$(id)” – this will make changing it much easier as only a single value (which itself can be patched).
LikeLiked by 2 people
Awesome thanks! I will try that next time. This scenario will come up quite a bit as we are transitioning from project to project and using Lucene less.