Result Folding Tutorial

This tutorial consists in a realistic example of result folding implementation in a search page using the JavaScript Search Interface Editor (see Understanding Result Folding and JavaScript Search Interface Editor).

In this case, you will be folding Vimeo video items of a Generic REST API source under the album items to which they belong (see Generic REST API Source Tutorial).

The final result should look as follows.

Search-ResultFolding2

Enabling result folding in a search page may introduce search page behaviors that may look erroneous. See Result Folding and Mismatching Result Counts and Why Are Some Child Items Not Folded? for additional information.

Step 0 - Requirements

The items involved in the result folding must have appropriate values in the required fields so that Coveo knows how to organize each item with regards to the others (see Understanding Result Folding).

In this tutorial, you decide to use the item URI as a unique identifier, and the album URI as the collection field value. Your fields are therefore configured as follows (see Generic REST API Source Tutorial):

Purpose Name Value
Collection field @foldingalbum Album URI
Item identification field @foldingid Video URI
Parent item identifier field @foldingparentalbum Album URI

In this tutorial, the folding fields all start with folding to make them easily identifiable and to ensure that they appear together when listed in alphabetical order. This is only for convenience purposes and not a field name requirement.