I am trying to setup featured results in query pipeline using Search API.
I found this documentation ( https://docs.coveo.com/en/13/cloud-v2-api-reference/search-api#operation/Create%20query%20pipeline%20statement ) to add statements in query pipeline. But there is no details how to send the featured result sitecore item detail in the API. By looking into the result from GET API i noticed that i need to send the urihash of the item. see sample below:
{ "id": "0e951b65-cbe0-4ab7-abda-69cd465c80e9", "description": "", "feature": "top", "definition": "top @urihash=\"OLOcLcwbwCQNMsXe\"", "position": 1, "ready": false, "detailed": { "expressions": [ "@urihash=\"OLOcLcwbwCQNMsXe\"" ] }, "childrenCount": 0 }
My questions are:
1. Is there more detailed documentation available to understand what can be payload for the API?
2. How to calculate the urihash for a sitecore item?
Answer by Jean-François L'Heureux · Sep 06, 2018 at 09:12 AM
@urihash
is a field computed at indexing time by the Coveo index for each document based on their @uri
field value. In the Coveo Cloud Content Browser, open the properties of a search result on the "fields" tab and filter for urihash.You can use top results with an expression not using @urihash
too. An expression of @someField=="some unique value that identifies a single search result"
is fine as well. However, I am unsure of the behavior of the edit screen in Coveo Cloud if someone go to edit a featured result created that way. It might throw an error.
In the case of Coveo for Sitecore, the fields are different for each indexed database (master, web...). Thus, you normally need 2 separate featured result statements to configure it for each source/database. A solution could be to make the Sitecore _id
field external for it to be @z95xid
in the Coveo index instead of @fz95xidYYYYY
:
<fieldMap ...> <fieldNames ...> <fieldType fieldName="_id" isExternal="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" /> </fieldNames> </fieldMap>
and use this field in the featured result expression:
@z95xid=="SHORT_ID_OF_THE_SITECORE_ITEM"
featured result options, contains, matches and is 1 Answer
How programmatically trigger an index Rebuild in Coveo Cloud V2 1 Answer
Need to have a Featured Result article at top of list when search page loads 1 Answer
Rest API: rest/v2 works but rest/v2/querySuggest returns 404 0 Answers
Importing Featured Result rule 1 Answer