Specify which templates to index

The Sitecore Search Provider framework offers various mechanisms to alter item indexing. One of them is template inclusion and exclusion.

By default, all Sitecore items under specified crawling roots are indexed. Template inclusion/exclusion lets you specify the items under these crawling roots that should be indexed, based on the Sitecore template they originate from.

This article focuses on configuring template inclusion/exclusion for Coveo indexes.

Including or excluding templates from the Coveo indexes

In the <SITECORE_INSTANCE_ROOT>\Website\App_Config\Include\Coveo\Coveo.SearchProvider.Custom.config file, use <include hint="list:AddIncludedTemplate"> or <exclude hint="list:AddExcludedTemplate"> elements as immediate children of the configuration/sitecore/coveo/defaultIndexConfiguration/documentOptions element. Then, specify the Sitecore templates to be included/excluded as child elements using their Item ID.

Important

When including or excluding multiple templates, remember to use unique element names for each template. Otherwise, only the last child of the <include>/<exclude> element of a given name will actually be included/excluded. Descriptive template element names can serve this purpose and help you identify the content you’re including or excluding from the index.

Example
<include hint="list:AddIncludedTemplate">
  <librariesTemplate>{BEAE618D-3D5B-483A-A9B3-2A5938DEB9A3}</librariesTemplate>
  <parksTemplate>{906B3C98-629B-41D6-890D-EF13B3C1E47D}</parksTemplate>
</include>
Example
<exclude hint="list:AddExcludedTemplate">
  <roadwaysTemplate>{930B0A7B-BACA-4D1E-B108-205CFDA1E778}</roadwaysTemplate>
  <parkingsTemplate>{5D1786F8-5165-413A-A299-A39ECDD4B0D3}</parkingsTemplate>
</exclude>
Note

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 must run a rebuild to delete them.