Get Smart Snippets for Sitecore content
Get Smart Snippets for Sitecore content
The Coveo Machine Learning (Coveo ML) Smart Snippet feature targets index items whose language
field value is English
.
By default, Sitecore English version items are indexed with en
as the language
field value.
To be scanned as potential smart snippet answers to user queries, you must add an {indexing-pipeline-extension} to your Sitecore source to replace en
with English
as the language
field value on Sitecore items.
This article provides instructions on how to do this.
Create the extension
-
On the Extensions (platform-ca | platform-eu | platform-au) page of the Coveo Administration Console, click Add extension.
-
In the Add an Extension panel, give your extension a name and a description. No need to select any additional item data options.
-
In the Extension script field, paste the following code:
language = document.get_meta_data_value('language') if language[0] == 'en': document.add_meta_data({'language': 'English'})
-
Click Add extension.
Associate the extension to your source
To link your extension to a source, you can proceed as follows:
-
On the Sources (platform-ca | platform-eu | platform-au) page of the Coveo Administration Console, click the Sitecore source you want to apply your extension to, and then click More > Add extensions in the Action bar.
-
In the Add extensions panel, in the Common tab, click Add > Extension.
-
In the Apply an Extension on Source Items panel, select your extension in the dropdown menu.
-
Under Stage, select Post-Conversion.
-
Under Action on Error, select Skip Extension.
-
In the Conditions to apply field, type
%[haslayout] == 1
. This condition ensures the extension is only applied to Sitecore HTML content items. -
Click Apply extension.
-
Back in the Add extensions panel, click Save.
-
Rebuild that source from your Sitecore instance, so that the extension gets executed on your items.
Note
For general guidance on adding indexing pipeline extensions, see Manage indexing pipeline extensions. |