3
votes

I understand that we can create N number of Cores in Solr. But I'm bit unclear on best practices for setting of Solr core for sitecore multisite implementation. Scenario: We have 5 sites in one sitecore instance. Each sites have search capability requirement.

Best practice questions:

  1. Is it ok for each sites to share core and master index?

  2. And, create a site specific cores for web index?

  3. Do we need to setup the configuration file or similar in order to establish relationship between site(s) vs. solr core?

3.1. And I guess, each site needs to have sitecore solr index configuration file? e.g. Sitecore.ContentSearch.Solr.SiteA.Index.Web (copy of out of box index file which contains custom indexing name?)

  1. Do we need to write any smartness (site context) such that search will use the correct solr Core?
1

1 Answers

4
votes

Answer for this question is really opinion-based. There is no one solution which would be ideal in every situation.

There was even a discussion on https://sitecorechat.slack.com about it.

First of all you need to think whether you want to reuse any content between the sites. If yes, then you can use Sitecore out of the box indexes. You will not get that much from separate indexes. Of course you can create separate indexes but some of the content will have to be crawled multiple times.

If you want to create separate indexes:

  1. Leave sitecore_core_index, sitecore_master_index and sitecore_web_index as they are - they will be used by Sitecore to run Content Editor search and other Sitecore background searches.

  2. Create Solr master and web cores for every site, e.g. site1_master_index and site1_web_index.

  3. For every site, duplicate the configuration for sitecore_master_index and sitecore_web_index and set proper locations of the content roots.

    E.g. create a copy of Sitecore.ContentSearch.Solr.Index.Master.config file (Site1.ContentSearch.Solr.Index.Master.config), and change its content to:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="site1_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
            </strategies>
            <locations hint="list:AddCrawler">
              <content type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>master</Database>
                <Root>/sitecore/content/site1</Root>
              </content>
              <media type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>master</Database>
                <Root>/sitecore/media library/site1</Root>
              </media>
            </locations>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

This configuration tells Sitecore to index only /sitecore/content/site1 and /sitecore/media library/site1 locations in this index.

  1. Use convention to get proper index search, e.g.:

    ISearchIndex SearchIndex
    {
        get
        {
            return ContentSearchManager.GetIndex(Sitecore.Context.Site.Name + "_" + Sitecore.Context.Database.Name + "_index");
        }
    }