Sitecore Instance Filter

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 CoveoForSitecoreLocalExpression component which adds filters for the current Sitecore instance to the constant query expression (cq) of Search API calls.

It registers a handler in the onSitecoreContextInitialization event triggered by the CoveoForSitecoreExpressions component.

The new Filter results based on the current Sitecore context database option lets you control whether to add a filter on the current Sitecore context database in the cq. Prior to the October 30, 2020 release, search results and recommendations were automatically filtered on the current Sitecore context database using a source==<SITECORE_SOURCE_NAME> filter in the advanced query expression (aq).

Usage notes

Insertion location

Coveo Hive

The Sitecore Instance Filter rendering is an Allowed Control in the following placeholder(s): Recommendations Components, Searchbox Components

Example insertion sequence for the Sitecore Instance Filter rendering.

Coveo Hive SXA

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

Example insertion sequence for the Sitecore Instance Filter rendering.

Data source options

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

Option name Description

Filter results based on the current Sitecore context database

Defines whether to include a filter such that only items from the current Sitecore context database will be included in query results or recommendations. Disabling this option automatically disables the other Sitecore-specific filters below.

Filter Sitecore results on the current context language

Defines whether to include only Sitecore items in the current context language in query results or recommendations.

Filter Sitecore results on the latest version

Defines whether to include only the latest version of Sitecore items in each language in query results or recommendations.

Sample Generated HTML and Corresponding Results

<div class="CoveoForSitecoreLocalExpression"
data-sc-filter-on-sitecore-context-database="true"
data-sc-filter-on-current-language="false"
data-sc-filter-on-latest-version="true">
</div>

Search API call cq:

Sitecore instance filter cq value | Coveo for Sitecore 5

Query Results:

Sitecore instance filter sample results | Coveo for Sitecore 5