Coveo Related Query

Implements the Coveo JavaScript Search Framework Recommendation component to get a result list related to the one executed in the main search interface.

The main purpose of the Coveo Related Query rendering is to execute a second query, slightly different from the current search interface query, which may take into account, or not, the current search interface filters in its aq and the current search interface query expression in its q.

Usage Notes

The Coveo Related Query rendering can be used as a standalone search interface. It always acts as a full-fledged search interface and requires a dedicated analytics component (see Coveo For Sitecore Analytics).

Insertion Location

The Coveo Related Query rendering is an Allowed Control in the following placeholder(s): Coveo UI, Recommendations.

Example insertion sequence for the Coveo Related Query rendering.

Coveo for Sitecore SXA rendering insertion locations aren’t limited by placeholder Allowed Controls. The Coveo Related Query rendering may therefore be inserted throughout the partial design, whether in Coveo for Sitecore or Sitecore placeholders.

Example insertion sequence for the Coveo Related Query rendering.

Data Source Options

Option name Description
Main search interface See mainSearchInterface component option
Use the search interface current filters Adds advancedExpression to the optionsToUse component option values
Use the search interface current query Adds expression to the optionsToUse component option values
Title The text to show in the header
Hide if no results See hideIfNoResults component option
Results per page See resultsPerPage component option
Excerpt length See excerptLength component option
Automatically trigger first query See autoTriggerQuery component option
Hide until first query See hideUntilFirstQuery component option
Enable history See enableHistory component option
Custom CSS classes See Insert Custom CSS in Coveo for Sitecore article
Initialization file name See Custom Initialization Scripts article
DOM unique Id Randomly generated HTML element id
Additional data attributes Allows use of Recommendation component options not directly available in the data source (see Passing Non-Fronted JavaScript Framework Properties to Hive Components)

Sample Generated HTML and Corresponding Visual Output

In the example below, the Use the search interface current query data source option is selected, and the Use the search interface current filters option isn’t selected.

<div id="coveoa061205e" class="CoveoRecommendation CoveoSearchInterface Coveostate 
CoveoComponentState CoveoComponentOptions CoveoQueryController coveo-after-initialization 
CoveoDebug" data-prebind-main-search-interface="mainSearchInterfaceSelector" 
data-main-search-interface="#coveoC606340E" data-hide-if-no-results="false" 
data-options-to-use="constantExpression,expression" data-results-per-page="5"
data-prebind-maximum-age="currentMaximumAge" data-title="Related Articles" 
data-applied-prebind="true" data-maximum-age="0" 
data-coveo-for-sitecore-event-registered="true">

Related Query Example

Recommended Articles