About the search result title selection sequence

This article applies to indexing with the native connector included in the Coveo for Sitecore package.

The title of an item is the first thing you see in a search result. This article explains the default title selection sequence and how to customize the behavior to suit specific needs.

Item title information collection process

Coveo for Sitecore collects several pieces of information that can be used for the item title and sends this information as metadata to the Coveo Platform. Then, in the Coveo indexing pipeline, a converter also extracts metadata from the item that can be used as the item title. Collecting all this title metadata ensures each item has a metadata value which it can map to the title Coveo field.

The following diagram summarizes the default title metadata collection process of an HTML item and how the title Coveo field value is determined.

Image of title metadata collected by Coveo for Sitecore and extracted in DPM | Coveo for Sitecore 5

Besides the way a value is assigned to the processing stage title metadata, the process is the same for all types of Sitecore items.

This behavior yields adequate item titles most of the time. If it doesn’t in your use case, you can customize your result titles.

Customize your result titles

What determines the metadata to be used for the title Coveo field is the mapping rule configured for this field in your Coveo organization source. Coveo for Sitecore configures sources with the default %[title] mapping rule, but you can edit this mapping to suit your needs.

Note

After editing the default %[title] mapping rule in your Coveo organization source and performing an indexing action in Sitecore, you’ll notice that Coveo for Sitecore adds another default %[title] rule to the one you defined. This is expected.

For example, you edit the %[title] rule and change it to %[title:crawler]. After reindexing, you’ll see two rules for the title field.

When multiple rules are defined, the first rule is applied when possible (in this example, %[title:crawler]).

You can change a mapping rule in two ways:

Use the crawling stage metadata for the item title

Coveo for Sitecore has a crawling stage title metadata fallback selection process. Coveo for Sitecore then sends the item to Coveo with its crawling stage title metadata value. In the case of HTML items, the processing stage title metadata extracted from the HTML content will be considered over the crawling stage title metadata. You might want your item search result titles to be the ones Coveo for Sitecore sends as the crawling stage title metadata values. If so, you can edit the title field mapping rule origin parameter so that it uses the crawling stage title metadata value.

To set the title field mapping rule origin parameter to crawler

  1. On the Sources (platform-ca | platform-eu | platform-au) page, click the target source, and then click Mappings in the Action bar.

  2. On the Common tab of the Edit mappings subpage, select the title field, and then click Edit mapping in the Action bar.

  3. Change the existing rule to %[title:crawler].

  4. Click Apply mapping, and then click Save.

  5. In your Sitecore instance, reindex the items you want to apply the new mapping to.

You can now validate the titles by inspecting your source items in the Content Browser.

Use another metadata (for example, Name, Display Name) for the item title

Coveo for Sitecore automatically sends the Sitecore item Name and Display name to Coveo as the _name and _displayname metadata respectively. You can use this metadata instead of the title metadata for your item titles.

To use the _displayname metadata in the title field mapping rule

  1. On the Sources (platform-ca | platform-eu | platform-au) page, click the source you want to target, and then click Mappings in the Action bar.

  2. On the Common tab of the Edit mappings subpage, select the title field, and then click Edit mapping in the Action bar.

  3. Change the existing rule to %[_displayname].

  4. Click Apply mapping, and then click Save.

  5. In your Sitecore instance, reindex the items you want to apply the new mapping to.

You can now validate the titles by inspecting your source items in the Content Browser.

Tip
Other metadata you can use

You can use any included Sitecore template field as the metadata in your mapping rules, not only Name and Display name. You might be able to find another appropriate metadata to use for your mapping by reviewing your source item field values, as follows:

  1. Locate an appropriate item title by reviewing the values indexed in the properties of a given indexed item.

  2. Note the corresponding Coveo field name in the Field column of that row.

  3. Search for that field in the Edit mappings subpage.

  4. Get the metadata name from the field’s mapping rule. For example, if the rule is %[location], the metadata name is location.

Mapping rules aren’t limited to a single metadata. You can create rules with multiple metadata names and even mix in some text (for example, Miss %[firstName] %[lastName]).

Set the title metadata for a specific media item type

Mapping rules are usually applied to all source items. You can be more granular and apply a mapping rule only to items of a specific type.

Example:

You want to create a mapping rule so that all PDF items use the Display name value as their title.

Note

The Sitecore item Display name is sent to the Coveo index as the _displayname metadata.

  1. On the Sources (platform-ca | platform-eu | platform-au) page, click the source you want to target, and then click Mappings in the Action bar.

  2. On the Specific tab of the Edit mappings subpage, click Add item type at the top right.

  3. In the Add an item type modal:

    1. Under Item type name, enter pdf.

      Tip

      See Find the source item type values to determine which item type names to use.

    2. Under Field, select the title field.

    3. Under Rules, add the following rule:

      %[_displayname]
    4. Click Add item type and mapping, and then click Save.

  4. In your Sitecore instance, perform an indexing action on your media items.

You can now validate your media item titles by inspecting your source items in the Content Browser.