Keeping #Sitecore #SOLR Index Names Unique for Multiple Projects

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.

Making the #Sitecore Switch from #Lucene to #SOLR with Custom Indexes

Recently I did my first conversion from Lucene to SOLR. With Lucene being phased out in Sitecore 9 this will probably be more common. You can find a lot of different installation guides in installing SOLR, but there are a few things that tripped me up that I want to prevent others from having to deal with.

Avoid Pitfalls

  • Make sure every Lucene config is disabled. Even the ones in the sub folders.
  • Make sure all the SOLR configs are enabled even the ones in the sub folders.
  • Make sure you don’t have any Cores with the same name inside the core.properties file. I had Sitecore_Master_Index in more than one file and all my Cores would disappear every time I restarted until I corrected the name.

Custom Indexes Differences

Some of this is obvious as you can replace Lucene with Solr, but some were not so obvious to me and I had to do some research and ask for help. I highlighted the less obvious ones.

From this:

<index
id=acme_widgetgroups_index” type=Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider>

To this:

<index
id=acme_widgetgroups_index” type=Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider>

From this:

<configuration
ref=contentSearch/indexConfigurations/defaultLuceneIndexConfiguration>

To this:

<configuration
ref=contentSearch/indexConfigurations/defaultSolrIndexConfiguration>

From this:

<fieldMap
type=Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch>

To this:

<fieldMap
ref=contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap>

From this:

<field fieldName=widgetfilters” storageType=YES” indexType=TOKENIZED” vectorType=NO” boost=1f” type=System.String” settingType=Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider />

To this:

<field fieldName=widgetfilters” returnType=string />

From this:

<documentOptions
type=Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilderOptions, Sitecore.ContentSearch.LuceneProvider>

To this:

<documentOptions
type=Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider>

I hope this helps you as you do your conversion. If you have any questions, feel free to ask.