Add or edit a body mapping
Add or edit a body mapping
Item body
The item body is the search-optimized HTML representation of the actual item content. For standard sources, the document processing manager (DPM) generates a representative body once the item reaches the processing stage of the indexing pipeline. This default body is displayed in the Quickview.
However, item bodies aren’t automatically generated when there’s no standard item content layout, or when the content is an assembly of values from all or some key records (each record is typically mapped to a specific field).
If this is the case, you can create an item body manually by adding a body
mapping rule since it will override the item’s default body
field.
When an item doesn’t have an item body, the assembled Quickview may not contain the relevant data or may not present it in an appropriate format. Typically, this occurs when indexing content using a Database or Push source. Furthermore, without an item body, the item won’t have a summary, concept, nor language detection.
Note
Without language detection, the item won’t populate the stem expansion, which will then affect the query performance. For example, when searching for the MainIndexLanguages, additional languages are added at query time which means that there are more terms to search. Therefore if items don’t have a set language, it means that Coveo will start searching in more and more languages and the overall query performance will be slower. |
Mapping process
The mapping process is similar for the item body (that is, 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.
Note
Since the |
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.
Note
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
|
To add or edit a body
mapping, follow the regular mapping addition procedure.
See Manage source mappings for details.
In the Edit mappings 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 for details.
You have a Web source for your company website. Without body mapping, the Quick view for each page displays the text on 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 for details.