Changing root in SearchProvider.config breaks the search api service
In the Coveo.SearchProvider.config file, I changed the Root field from /sitecore to the root of my site's content node. However, when I make this change, it breaks the Search API. When I open the CoveoDiagnosticsPage, it says that there was an error with the Coveo Search REST Endpoint.
If I want Coveo to only index my content (not /sitecore/templates, /sitecore/layouts, etc…) do I need to change it somewhere else as well?
Here's what the change looked like (I changed it for the Coveomasterindex as well as Coveowebindex):
<locations hint="list:AddCrawler"> <crawler type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase"> <Database>master</Database> <Root>/sitecore/content/MySite</Root> <StopOnError>true</StopOnError> </crawler> </locations>
Unfortunately, it is currently impossible to modify the crawler root this way. Coveo for Sitecore needs to be able to index the indexed database's root item because in some cases we need to get its
IIndexable object when we need to do operations without a Sitecore context.
The best way to change what's indexed is using inbound filters.
We ship Coveo for Sitecore with a commented inclusion inbound filter in the
Coveo.SearchProvider.config file under the
sitecore/pipelines/indexing.filterIndex.inbound element. You can uncomment it, change the paths and rebuild your indexes.
<!-- Uncomment this to use an inbound filter on item paths. By default, it will only index items in /sitecore/content. You can specify multiple paths by separating them with a semi-colon. --> <!-- <processor type="Coveo.SearchProvider.InboundFilters.ItemPathInboundFilter, Coveo.SearchProviderBase"> <ContentStartPaths>/sitecore/content</ContentStartPaths> </processor> -->
If you're on Sitecore 7.X with the default Coveo for Sitecore configuration, it is not recommended to index only parts of the Sitecore content tree. This is because Coveo for Sitecore replaces the Lucene indexes. Indexing only a part of the content tree will affect the Content Editor search (you won't be able to search for all the items).
If you're on Sitecore 8.X (or 7.2+ with a modified Coveo for Sitecore configuration to enable side-by-side indexing with Lucene), you can use inbound filters without problem.
I would recommend not to change the root. Instead, use inbound filtering: https://developers.coveo.com/display/public/SC201504/Controlling+What+Gets+Indexed+and+How
You can also create a new index for a subsection of the site but I highly recommend filtering.