Specify Which Templates to Index

The Sitecore Search Provider framework offers various parameters to alter item indexing. One of them is templates inclusion and exclusion. This method allows you to include or exclude items from indexing based on the Sitecore template they originate from.

This only affects the internal SitecoreItemCrawler module and not the Coveo Search Provider directly, so it can be used on any Sitecore Search Provider index.

Including or Excluding Templates from the Coveo Indexes

To apply the configuration only to Coveo for Sitecore indexes, declare the following nodes in your Coveo.SearchProvider.Custom.config file.

Sitecore 8.0-

Add the following <include> and <exclude> elements as immediate children of the defaultIndexConfiguration element.

<include hint="list:IncludeTemplate">
    <sampletemplate>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</sampletemplate>
</include>
<exclude hint="list:ExcludeTemplate">
    <samplelayout>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</samplelayout>
</exclude>

Sitecore 8.1+

Add the following <include> and <exclude> elements as immediate children of the defaultIndexConfiguration/documentOptions element.

<include hint="list:AddIncludedTemplate">
    <sampletemplate>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</sampletemplate>
</include>
<exclude hint="list:AddExcludedTemplate">
    <samplelayout>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</samplelayout>
</exclude>

When including or excluding many templates, remember to use different element names for each template. Otherwise, only the last child of the <include>/<exclude> element of a given name will actually be included/excluded.

Excluding items from the indexing means that those items aren’t crawled anymore. If you already had items based on these templates in your index, they won’t be automatically removed from the index. You should run a full rebuild to delete them.

Recommended Articles