Add or Edit a Body Mapping

When an item goes through the mapping stage of the indexing pipeline, its retrieved metadata (e.g., file format, last modification date, author name) is used to populate various fields in the index (e.g., @filetype, @date, @author). This makes the item metadata searchable.

Mapping Process

The mapping process is similar for the item body, i.e., actual content, which is mapped to the body Coveo index field whenever possible. The content is indexed, made searchable, and visible from the Content Browser in the Item Properties panel, under the Quick View tab, as well as from JavaScript Search Framework search interfaces via the Quickview component.

When you index a PDF file, the file body contains all the text visible when you print the PDF.

The indexing pipeline handles the body field in a slightly different way from other fields, since body is the only field that modifies search results in the free text of an indexed item. This allows you to customize search results and to update the corresponding Quick View. However, this works with fairly simple body mappings only. To implement a more advanced customization, you must instead leverage indexing pipeline extensions.

Since the body mapping applies at pre-conversion only, only metadata extracted at the Crawling stage or by a pre-conversion extension can be mapped (see Coveo Cloud V2 Indexing Pipeline). Metadata extracted at the conversion stage or by a post-conversion extension can’t appear in a custom item body.

Quick View

For standard sources, the indexing pipeline Crawling stage creates a representative body for the item content. This default body is displayed in the Quick View (see Coveo Cloud V2 Indexing Pipeline).

A Jira source issue item consists of a collection of fields defining the issue, such as Summary, Reporter, Assignee, Description, Comments, Creation date, and Modification date. The Jira source crawler automatically creates a default body made up of the key fields that’s available in the Quick View.

However, Coveo Cloud may not be able to automatically create item bodies to display in the Quick View when there’s no standard item content layout, or when the item body is an assembly of values from all or some key records. Each record is typically mapped to a specific field. The assembled Quick View may therefore not contain the relevant data or not present it in an appropriate format. Typically, such bodies result from indexing content using a Database or Push source.

A source indexes a contact database. Each item is one contact consisting in several records such as the contact’s first name, last name, gender, title, email address, phone number, etc. Every item record is mapped to a specific field. There’s no standard UI arrangement for all the item records that a user can view, and the database crawler can therefore not create an item body to display in the Quick View.

Excerpt

An excerpt is generated from segments of the body of an indexed document and it generally includes highlighted occurrences of the queried terms. During the indexing process, the cleaned text of each item’s content is recorded. In a query, relevant segments that include the keywords are extracted from the recorded text to build the excerpt.

The purpose of the excerpt is to provide key pieces of the document to help you identify if the document contains the information you’re searching.

The compressed cleaned text recorded for each item is limited in size to optimize the index size and query performances, therefore excerpts for large documents, such as PDF files with several hundred pages, only show the content from the beginning of the document.

Add or Edit an Item Body Mapping

When you have the required privileges, you can add custom body mappings and edit Coveo default body mappings. You can define the desired body with static HTML and metadata placeholders to be replaced with item metadata values. The resulting customized item body is then displayed in the Quick View.

Adding a body mapping rule to an item overrides the default body field. This action should therefore be considered only for items that:

To add or edit a body mapping, follow the regular mapping addition procedure (see Adding and Managing Source Mappings).

In the Apply a Mapping on All/Specific Item Types of a Source or Edit Mappings Applied on All/Specific Item Types of a Source panel, take the following into account:

  • Under Field, select body.

  • Under Apply to, select All items (common) or Specific item types depending on whether you want to apply your item body mapping to a certain source item type or to all source content, regardless of the item type.

  • If you selected Specific item types under Apply to, select the item types on which you want to apply the body mapping rule.

  • Under Rules, enter the field content. The string can be plain text, HTML, or use a placeholder (see Mapping Rule Syntax Reference).

You have a Web source for your company website. Without body mapping, the Quick View for each page displays the text in the page. Your Contact Us page Quick View is therefore the following:

Contact Us
Your comments and questions are always welcome!
Phone: 1-800-555-2222
Email: info@mycompany.com

However, you don’t want the page text to be displayed in the Quick View. You therefore chose to replace the text with a simple string stating the page title. Your body mapping rule is therefore: Page Title: %[title]. As a result, when you open the Quick View for item Contact Us, the following would be displayed:

Page Title: Contact Us

What’s Next?

Ensure that your body mapping works as expected in the Content Browser (see Quick View Tab).

Recommended Articles