Query Filter
Query Filter
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 CoveoForSitecoreFilterExpression component which adds a filter expression (often created through the Sitecore Rules Editor) to the advanced query expression (aq
).
Usage notes
-
The Sitecore Rules Editor is only available with the Enterprise Edition. The Sitecore Rules Editor is required to set
Filter expression rules
in the data source. Therefore, when not using the Enterprise Edition, only theExclude bucket folders in results
andExclude media folders in results
options are shown in the data source. -
The Query Filter rendering is added automatically with the Coveo Search Interface rendering and Coveo Tab renderings.
Insertion location
Coveo Hive
The Query Filter rendering is an Allowed Control in the following placeholder(s): UI Header
, Recommendations Components
, Searchbox Components
Coveo Hive SXA
The Coveo for Sitecore SXA Query Filter rendering is meant to be inserted in specific placeholders (that is, UI Header
, Recommendations Components
, Searchbox Components
).
Data source options
The following table lists the available data source options for this rendering.
Option name | Description |
---|---|
Enterprise edition Filter expression rules |
List of filter expression rules to apply on queries. When querying on a Coveo Tab where a filter expression rule has been set, this rule is applied on top of rules set on the Coveo Search Interface. |
Exclude bucket folders in results |
Specifies whether to exclude bucket folder items from results.
When selected, either in the Coveo Search Interface or in the active Coveo Tab data source, this option adds |
Exclude media folders in results[1] |
Specifies whether to exclude media folder items from results. When selected, either in the Coveo Search Interface or in the active Coveo Tab data source, this option adds |
Sample Generated HTML and Corresponding Query Expressions
In the example below, Query Filter data sources are configured both on the Coveo Search Interface and on a specific Coveo Tab.
On the Coveo Search Interface, the data source options are set as follows:
-
Filter expression rule
: where the item has layout -
Exclude bucket folders in results
: enabled -
Exclude media folders in results
: enabled
Coveo Search Interface HTML:
<div class="CoveoForSitecoreFilterExpression"
data-sc-filter-scope-node="{"advanced" : {"type" : "and" , "left" : {"type" : "field" ,
"fieldName" : "HasLayout" , "operator" : {"name" : "==" , "value" : 1},
"fieldValueType" : {"name" : "boolean" , "value" : 0},"fieldValues" : [true]},
"right" : {"type" : "not" , "operand" : {"type" : "field" , "fieldName" : "_template" ,
"operator" : {"name" : "==" , "value" : 1},"fieldValueType" : {"name" : "string" ,
"value" : 3},"fieldValues" : ["ADB6CA4F03EF4F47B9AC9CE2BA53FF97" ,
"FE5DD82648C6436DB87A7C4210C7413B"]}}}}">
</div>
On a Coveo Tab, the data source options are set as follows:
-
Filter expression rule
: where the item is theBlog articles
item (that is, Item ID = 713B102E34824750AC6F46E08ECFC163) or one of its subitems -
Exclude bucket folders in results
: disabled -
Exclude media folders in results
: disabled
Coveo Tab HTML:
<div class="CoveoForSitecoreFilterExpression" data-sc-scope-to-tab="coveod9c70725"
data-sc-filter-scope-node="{"advanced" : {"type" : "field" , "fieldName" : "_path" ,
"operator" : {"name" : "==" , "value" : 1},"fieldValueType" : {"name" : "string" ,
"value" : 3},"fieldValues" : ["713B102E34824750AC6F46E08ECFC163"]}}">
</div>
Search API call aq
when that Coveo Tab is the active:
MediaLibraryCrawler
only indexes items under /sitecore/media library/Files
in the Sitecore content tree.