Coveo for Sitecore 5 is now available!

Specifying which Fields to Index

The Sitecore Search Provider framework offers various parameters to alter item indexing.

One of them is Fields inclusion and exclusion. 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 Fields from the Indexing

Coveo for Sitecore 4.1 (October 2018) You can now include or exclude fields from the list of indexed fields directly through the Fields section of the Command Center. This feature is accessible at http://<INSTANCE_HOSTNAME>/coveo/command-center/index.html#fields/template/ (see Understanding the Indexing Manager).

To speed up indexing operations, Coveo for Sitecore already excludes a list of predetermined fields, which you can find in the Coveo.SearchProvider.config configuration file, under the <exclude hint="list:ExcludeField"> or <exclude hint="list:AddExcludedField> XML element. To alter them, include your modifications in the Coveo.SearchProvider.Custom.config file.

You can also skip fields by using a coveoItemPostProcessingPipeline (see Using the Coveo Pipelines).

Typically, these fields can be configured this way:

Sitecore 7.2 to 8.0

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

<include hint="list:IncludeField">
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
</include>
<exclude hint="list:ExcludeField">
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
</exclude>

Sitecore 8.1+

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

<include hint="list:AddIncludedField">
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
</include>
<exclude hint="list:AddExcludedField">
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
</exclude>

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

Including or Excluding Fields Using Both Configuration Files and the Command Center

Coveo for Sitecore 4.1 (October 2018)

You can include fields using both configuration files and the Command Center. However, you might be surprised by certain system behaviors if you don’t roperly understand:

  • what happens when you add or remove fields using the Command Center
  • how Coveo for Sitecore ultimately determines the list of fields to index

The following diagram shows an example of a field inclusion patch file configuration. Including or excluding a field through the Command Center simply adds/removes a field element in the <include> element of the last Coveo for Sitecore configuration patch file in the file patching order (Coveo.SearchProvider.Fields.Custom.config). Field elements added within the <include> element of Coveo.SearchProvider.Fields.Custom.config follow a naming convention that make them unique, such that they’re always added to the field elements you might have added in Coveo.SearchProvider.Custom.config.

At run time, the IncludeFieldsFromConfigOnlyProcessor processor retrieves the field elements in the <include hint="list:AddIncludedField" > element of the compiled configuration (see Default Processing Sequence Diagram). These are the fields Coveo for Sitecore ultimately indexes.

Hence, with the sample configuration above, try using the Command Center to remove one of the two fields that you included through the Coveo.SearchProvider.Custom.config file. If you do, you will notice, after the Save & Restart, that Coveo for Sitecore has not removed the field. The only way for you to exclude those two fields now is to remove them from the Coveo.SearchProvider.Custom.config file.

What's Next for Me?