Remove Filtering on the Current Sitecore Context Database

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 is designed to index Sitecore XP and XM instance items. Indexing Sitecore instances using Coveo for Sitecore typically produces two sources (that is, two Sitecore sources) in your Coveo organization index, one source for your Sitecore master database items, and the other for the web database items.

By default, search interfaces assembled in the Sitecore Experience Editor using Coveo Hive renderings only display results from the current Sitecore context database. Hence, when editing a Coveo-powered search interface in the Experience Editor, the result list shows only items from the master Sitecore source, whereas the published search interface shows only results from the web Sitecore source.

The Sitecore Instance Filter adds a source==<SITECORE_SOURCE_NAME> filter in Search API calls. Given <SITECORE_SOURCE_NAME> represents a Sitecore source, all items from non-Sitecore sources in your Coveo organization aren’t included in Search API call responses. As a result, Sitecore XC content (which you must not use Coveo for Sitecore to index) isn’t included by default in Coveo for Sitecore search interfaces built in Sitecore.

Solutions for Querying Over External Source Content

There are different ways you can make a Coveo for Sitecore search interface query over external source content:

The focus of this article is to explain the latter.

Disabling Filtering on the Sitecore Context Database

As stated before, the Sitecore Instance Filter rendering adds a filter on the source field such that only content from the source associated with the current Sitecore context database is returned on Search API calls. In old versions of Coveo for Sitecore, this filtering was hard-coded in the Sitecore Instance Filter rendering. However, the October 30, 2020 release of Coveo for Sitecore introduced a new Filter results based on the current Sitecore context database option in the Sitecore Instance Filter data source, which now lets you control whether you want to filter on the current Sitecore context database.

The Sitecore Instance Filter rendering is embedded in the Coveo Search Interface rendering. Hence, you can disable the Filter results based on the current Sitecore context database option in the Coveo Search Interface data source, which also automatically disables the other Query Filter section filters below it.

Image of Query Filter section of Coveo Search Interface data source | Coveo for Sitecore 5

The following renderings also embed the Sitecore Instance Filter:

  • Coveo Recommendations

  • Coveo Related Query

The data source of these two renderings also expose the Filter results based on the current Sitecore context database option. You can therefore disable filtering on the current Sitecore context database for Coveo Recommendations and Coveo Related Query results the same way you do on the Coveo Search Interface rendering.