Coveo Related Query
Coveo Related Query
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. |
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 advanced query expression (aq
) and the current search interface query expression in its basic query expression (q
).
Usage notes
-
The Coveo Related Query rendering always acts as a full-fledged search interface and requires a dedicated analytics component (see Coveo for Sitecore Analytics).
-
When bound to a search interface through the
Main search interface
data source option, the Coveo Related Query rendering inherits the Sitecore Instance Filter configurations set on that search interface. When not bound to a search interface, you can add Sitecore Instance Filter and Query Filter renderings in theRecommendations Components
placeholder to apply filtering on your Sitecore instance items. -
The Sitecore Instance Filter rendering is now added automatically with the Coveo Related Query rendering. This adds the new
Filter results based on the current Sitecore context database
data source option which lets you control whether to add a filter on the current Sitecore context database in the constant query expression (cq
). Prior to the October 30, 2020 release, related query recommendations were automatically filtered on the current Sitecore context database. -
You can customize the CSS associated with this rendering.
Insertion location
Coveo Hive
The Coveo Related Query rendering is an Allowed Control in the following placeholder(s): Coveo UI
, Recommendations
.
Coveo Hive SXA
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.
Data source options
The following table lists the available data source options for this rendering.
Option name | Description |
---|---|
Main search interface |
See the mainSearchInterface component option. |
Use the search interface current filters |
Adds |
Use the search interface current query |
Adds |
Title |
The text to show in the header. |
Hide if no results |
See the hideIfNoResults component option. |
See the Sitecore Instance Filter rendering data source options. |
|
Filter results on the current context language |
See the Sitecore Instance Filter rendering data source options. |
Filter results on the latest version |
See the Sitecore Instance Filter rendering data source options. |
Results per page |
See the resultsPerPage component option. |
Excerpt length |
See the excerptLength component option. |
Automatically trigger first query |
See the autoTriggerQuery component option. |
Hide until first query |
See the hideUntilFirstQuery component option. |
Enable history |
See the enableHistory component option. |
Custom CSS classes |
See Insert Custom CSS. |
Initialization file name |
|
DOM unique ID |
Randomly generated HTML element ID. |
Additional data attributes |
Allows use of the Coveo JavaScript Search Framework Recommendation component options that aren’t directly available in the data source. |
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">