About the Search Result Title Selection Sequence

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 to 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.

After editing the default %[title] mapping rule in your Coveo organization source and performing an indexing action in Sitecore, you will 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.

Coveo for Sitecore re-adds the default mapping rule after an indexing action | Coveo for Sitecore 5

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.

    Selecting the Manage Mapping option on a source
  2. In the Edit mappings panel, click the title field, and then click Edit.

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

    Setting the origin to crawler in the mapping rule | Coveo for Sitecore 5
  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.

    Selecting the Manage Mapping option on a source | Coveo for Sitecore 5
  2. In the Edit mappings panel, click the title field, and then click Edit.

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

    Using the display name in the mapping rule | Coveo for Sitecore 5
  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 field values indexed in the properties of a given indexed item (see item 1 in screenshots below).

  2. Get the name of the corresponding Coveo field (see item 2 in screenshots below).

  3. Search for that field in your source mappings (see item 3 in screenshots below).

  4. Get the metadata name from the mapping rule for that field (see item 4 in screenshots below).

First steps to finding the right metadata to use | Coveo for Sitecore 5 Last steps to finding the right metadata to use | Coveo for Sitecore 5

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.

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.

    Selecting the Manage Mapping option on a source | Coveo for Sitecore 5
  2. In the Edit mappings panel, select the Specific tab.

  3. In the upper-right corner, click Add > Item type.

  4. In the Add an Item Type panel, click Select or create an item type, type pdf in the Filter field, and then select Enter.

    Adding the pdf item type | Coveo for Sitecore 5
    Tip

    For help on determining the item type value to use for a given file type, see Find the Source Item Type Values.

  5. Click Add type.

  6. In the Edit mappings panel, click Add > Mapping in the upper-right corner.

  7. Configure your mapping as follows:
    Field: title
    Apply to: Specific item types > pdf
    Rules: %[_displayname]

  8. Click Apply mapping.

  9. In the Edit mappings panel, click Save.

  10. 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.