Query Ranking

Warning
Legacy feature

This article pertains to the Coveo Hive framework which is now in maintenance mode.

Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details.

Coveo for Sitecore Specific Rendering Implements the CoveoForSitecoreRankingExpression component which represents a query ranking expression (QRE) created from rules defined in the Sitecore Rules Editor. This query ranking expression is added to the advanced query expression (aq) on calls to the Search API to modify the item ranking score value.

Usage notes

  • The Sitecore Rules Editor is only available with the Enterprise Edition. The Sitecore Rules Editor is required to set Boost expression rules in the data source.

  • The Query Ranking rendering is added automatically with the Coveo Search Interface rendering and Coveo Tab renderings.

  • You need to insert the Coveo Relevancy Sort rendering and select this sorting criterion for your result list to obtain document score values, otherwise score values will be zero on all result items.

  • Boosting is cumulative. When you specify boosting rules on the Coveo Search Interface and on the active Coveo Tab, items matching both rules are boosted by the sum of both modifier numbers.

Insertion location

Coveo Hive

The Query Ranking rendering is an Allowed Control in the following placeholder(s): Coveo UI, Recommendations Components, Searchbox Components

Example insertion sequence for the Query Ranking rendering.

Coveo Hive SXA

The Coveo for Sitecore SXA Query Ranking rendering is meant to be inserted in specific placeholders (that is, Coveo UI, Recommendations Components, Searchbox Components).

Example insertion sequence for the Query Ranking rendering.

Data source options

The following table lists the available data source options for this rendering.

Option name Description

Boost expression rules

List of condition-action rules created in the Sitecore Rules Editor. The Coveo Boosting number is used as the QRE modifier value, which is correlated to the item ranking score by a 1 to 10 ratio.

Sample Generated HTML and Corresponding Result

To boost the score of commerce items currently on sale by 1000 points, you define the following query ranking rule with a number value of 100 (as per the modifier-score 1 to 10 ratio) in the Coveo Search Interface data source:

Query Ranking Rule Example | Coveo for Sitecore 5

Generated HTML:

<div class="CoveoForSitecoreRankingExpression"
data-sc-ranking-scope-node="{"rankingExpressions" : [{"expression" : {"type" : "field" ,
"fieldName" : "OnPromotion" , "operator" : {"name" : "==" , "value" : 1},
"fieldValueType" : {"name" : "string" , "value" : 3},
"fieldValues" : ["1"]},"modifier" : 100}],"rankingFunctions" : [],"textualRankingExpressions" : []}">
</div>

Search API call aq:

QRE sample aq

Matching document score:

Search API call response for an item before adding query ranking rule
Search API call response for the same item after adding query ranking rule