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:
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.
Create Solr master
and web
cores for every site, e.g. site1_master_index
and site1_web_index
.
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.
Use convention to get proper index search, e.g.:
ISearchIndex SearchIndex
{
get
{
return ContentSearchManager.GetIndex(Sitecore.Context.Site.Name + "_" + Sitecore.Context.Database.Name + "_index");
}
}