Interpreting item body as an HTML item
Interpreting item body as an HTML item
When indexing an item in your Coveo organization, that item must go through the mapping stage of the indexing pipeline process. At this stage, the item metadata is associated with fields in your index.
The mapping process is similar for the body of an item (that is, actual content) which is mapped to the body field whenever possible.
When analyzing your items through the Content Browser or from your search interface, you may find occurrences where an item excerpt and Quick view display HTML tags that come from the original repository document such as a web page, file, database record, or Salesforce object.
To remove these HTML tags, apply a mapping rule that will cause the item body to be interpreted as an HTML document rather than plain text.
Depending on your needs, you may want to interpret each item in a source as HTML, or to interpret a subset of items in a source as HTML.
Before following either procedure, confirm that your source type exposes the item’s HTML as metadata.
In some cases, the source mapping populates the body field by concatenating several metadata values.
|
|
Using the following procedures modifies the default mapping behavior of the |
Interpreting each item in a source as HTML
-
On the Sources (platform-ca | platform-eu | platform-au) page, click your source, and then click Mappings in the Action bar.
-
On the Common tab of the Edit mappings subpage, locate the body field. For example, that would be the
spobodyfield in a SharePoint Online source. -
Click that field, and then click Edit mapping in the Action bar.
-
In the panel that appears:
-
Under Rules, enclose the
%[<METADATA_NAME>]placeholder in<html>and<body>tags. For example, if the metadata used in the mapping rule isdescription, the updated rule would be:<html><body>%[description]</body></html>. See Mapping rule syntax reference to learn how rules are applied. -
Click Apply mapping.
-
-
Back in the Edit mappings subpage, click Save and rebuild source.
Once the source rebuild process is complete, HTML tags originally appearing in the metadata used to populate the body field of your source items should be interpreted as such in item excerpts and quickviews. The items should also appear as HTML files in the Content Browser (platform-ca | platform-eu | platform-au) or in your search interface.
|
|
Coveo crawlers rely on multiple fields, depending on the repository, to create the For example, your item body that contains HTML tags is filled with the values of the In order to remove the HTML tags from the item body, you create a mapping rule that maps the This action prevents the relevant data contained in the |
Interpreting a subset of items in a source as HTML
-
On the Sources (platform-ca | platform-eu | platform-au) page, click your source, and then click Mappings in the Action bar.
-
On the Specific tab of the Edit mappings subpage, click Add item type at the top right.
-
In the Add an item type modal:
-
Under Item type name, enter the name of the item type. See Find the source item type values to determine which item type names to use.
-
Under Field, click the body field. For example, that would be the
spobodyfield in a SharePoint Online source. -
Under Rules, enclose the
%[<METADATA_NAME>]placeholder in<html>and<body>tags. For example, if the metadata used in the mapping rule isdescription, the updated rule would be:<html><body>%[description]</body></html>. See Mapping rule syntax reference to learn how rules are applied. -
Click Add item type and mapping.
-
-
Back in the Edit mappings subpage, click Save and rebuild source.
Items matching the selected item type should no longer display HTML tags. The items should also appear as HTML files in the Content Browser (platform-ca | platform-eu | platform-au) or in your search interface.
|
|
Coveo crawlers rely on multiple fields, depending on the repository, to create the For example, your item body that contains HTML tags is filled with the values of the In order to remove the HTML tags from the item body, you create a mapping rule that maps the This action prevents the relevant data contained in the |