Performing Aggregation Operations on Facet Values Using the Coveo for Sitecore Legacy Search UI Framework
Performing Aggregation Operations on Facet Values Using the Coveo for Sitecore Legacy Search UI Framework
Computed values can be displayed for each facet item in Coveo for Sitecore. The computed values can either be the sum, the average, the minimum, or the maximum of a numeric field associated with the facet value. This tutorial demonstrates how to associate computed fields to a new facet.
Steps
-
Open the Sitecore Content Editor.
-
Create a new template named
Flightunder the node/sitecore/Templates/User Defined.
-
Add the following fields to the template:
-
Company (Single-Line-Text)
-
Price (Number)
-
-
Add a new
Facetitem namedCompanyunder the node/sitecore/System/Settings/Buckets/Facets.
-
Add a folder
Flightsunder the node/sitecore/Content -
Add three flight items in the folder, having the same company but different prices.
-
Rebuild your master index through the Sitecore Control Panel or rebuild only the
/sitecore/content/Flightstree through the Develop Toolbar (see Coveo for Sitecore Indexing Guide).
-
Open your Coveo-powered search page in the page editor.
-
Add a facet component to your page.
-
Set the following properties for your facet component:
-
Title:
Airlines -
Field:
Company -
Computed field:
Price -
Computed field operation:
Average -
Computed field format:
c0
-
-
Save your page.
-
Validate that the price average is displayed for each of your facet items.