THIS IS ARCHIVED DOCUMENTATION

Facet Suggestions Using the Coveo for Sitecore Legacy Search UI Framework

Coveo for Sitecore 4.1 (November 2018)

The Omnibox Component can propose facet values to the user. Clicking a facet suggestion selects this facet value and refreshes the result page.

This component can be added to both the full search interface or the standalone search box.

Search Interface (Coveo Search/Coveo Search View)

Prerequisites

  • The Omnibox must be enabled on your page (see Search Component Properties).
  • You need to have at least one Facet Component on your page.

Facet suggestions are visible as soon as the prerequisites are met. If they’re not showing:

  1. Open the Facet component properties using the Experience Editor or the Content Editor.

  2. Check the Include facet values in the omnibox checkbox.
  3. Save the item.

Standalone Search Box (Coveo Search Box/Coveo Search Box View)

Prerequisites

  • A copy of the default Coveo Search Box component (see Duplicating the Coveo Search Component).
  • You need to have at least one Facet Component on the page specified in the Search Page Item of your search box component properties.
  • You need to use the Coveo Search Resources component (Web Forms) or the Coveo Search View Resources component (MVC), not the Coveo Search Box Resources component (Web Forms) or the Coveo Search Box View Resources component (MVC).

Instructions

  1. Locate the element with the CoveoSearchbox class in the ascx file (Web Forms) or the cshtml file (MVC) of your Coveo Search Box component copy.

  2. Add the following element anywhere between the opening <div> tag and the closing </div> tag of that element:

    1. Web Forms

       <div class="CoveoFacet" data-title="Type" id="<UNIQUE_ID>" data-id="<UNIQUE_ID>" data-field='<%= Model.ToCoveoFieldName("myField") %>' data-include-in-omnibox="true" data-preserve-position="false"></div>
      
    2. MVC

       <div class="CoveoFacet" data-title="Type" id="<UNIQUE_ID>" data-id="<UNIQUE_ID>" data-field='@(Model.ToCoveoFieldName("myField"))' data-include-in-omnibox="true" data-preserve-position="false"></div>
      
  3. Replace the <UNIQUE_ID> placeholders with the value found in the properties of your facet (see Facet Component Properties).

  4. Save the file.