Coveo Distance Facet Range

The Coveo Dynamic Distance Facet Range is now recommended over the Coveo Distance Facet Range rendering.

Implements the Coveo JavaScript Search Framework FacetRange component to display a facet whose values are expressed as numeric ranges. The facet is based on an item-user distance value computed by the Coveo index.

Usage Notes

  • To use the Coveo Distance Facet Range rendering, you need to:

    • Add the Coveo Distance Resources rendering and a Position Provider rendering to automatically calculate the user-item distance and store it in a field.

    • Select the name of the Distance field to store the distances in. By default, Coveo for Sitecore suggests distance as the name of this field (which comes from the List Value Parameter item located in the /sitecore/system/Settings/Indexing and Search/Coveo/Distance Field Names folder). Refrain from creating custom List Value Parameter items: these items are either not located by the Coveo for Sitecore data source or deleted during an upgrade.

  • To use the Coveo Distance Facet Range rendering with custom numeric ranges, create a content tree structure, such as the one below, containing a Custom Numeric Ranges item with children Numeric Range items. This structure can be placed anywhere in the content tree. You will reference the location of the Custom Numeric Ranges item in the Facet value ranges data source option (see Configure Custom Ranges for a Date Range or Numeric Range Facet).

    Distance Facet Range required items

  • Any change to the facet range value selection(s) triggers a new Search API call.

Insertion Location

The Coveo Distance Facet Range rendering is an Allowed Control in the following placeholder(s): Facets

Example insertion sequence for the Coveo Distance Facet Range rendering.

Coveo for Sitecore SXA rendering insertion locations aren’t limited by placeholder Allowed Controls. The Coveo Distance Facet Range rendering may therefore be inserted throughout the partial design, whether in Coveo for Sitecore or Sitecore placeholders.

Example insertion sequence for the Coveo Distance Facet Range rendering.

Data Source Options

Option name Description
Title See title component option
Distance field See field component option
Facet name See id component option
Number of values See numberOfValues component option
Sort See sortCriteria component option
Ignore accents in facet search See facetSearchIgnoreAccents component option
Allowed facet values See allowedValues component option
Facet value caption This option is exposed for legacy reasons.
Enable collapse button See enableCollapse component option
Enable settings button See enableSettings component option
Sort criteria displayed in the settings menu See availableSorts component option
Enable search for the facet See enableFacetSearch component option
Number of values to display in the facet search results See numberOfValuesInFacetSearch component option
Enable more/less button See enableMoreLess component option
Number of additional facet values to fetch when 'More' is clicked See pageSize component option
Include facet values in the omnibox This option is exposed for legacy reasons. It is not recommended to use it. Specifies if the facet should push data to the Omnibox component.
Include facet values in the breadcrumb See includeInBreadcrumb component option
Maximum number of facet values displayed in the breadcrumb See numberOfValuesInBreadcrumb component option
Computed field See computedField component option
Computed field operation See computedFieldOperation component option
Computed field format See computedFieldFormat component option
Computed field caption See computedFieldCaption component option
Is multi-value field See isMultiValueField component option
Facet uses the AND operator See useAnd component option
Allow user to select the facet operator See enableTogglingOperator component option
Facet accuracy determined by the number of scanned results Sets the injectionDepth component option to a preset value
Enable 'Save Facet State' option in Settings menu See enableSettingsFacetState component option
Preserve facet position under mouse on new facet query See preservePosition component option
Facet value ranges Specifies whether to use automatically generated numeric ranges or custom numeric ranges created in Sitecore.
DOM unique Id Randomly generated HTML element id.
Additional data attributes Allows use of the Coveo JavaScript Search Framework FacetRange component options that aren't directly available in the data source.

Sample Generated HTML and Corresponding Visual Output

<div id="coveoc6906c6e" class="CoveoFacetRange"
data-available-sorts="alphaascending,alphadescending,nosort,occurrences,score"
data-enable-settings="true" data-prebind-field="fieldTranslator" data-field="@distance"
data-injection-depth="1000" data-sort-criteria="nosort" data-title="Distance"
data-ranges="[{"start":"0","end":"50","endInclusive":false,"label":"Less than 50 km"},
{"start":"50","end":"100","endInclusive":false,"label":"50 - 100 km"},
{"start":"100","end":"200","endInclusive":false,"label":"100 - 200 km"},
{"start":"200","end":"500","endInclusive":false,"label":"200 km - 500 km"},
{"start":"500","end":"100000000","endInclusive":false,"label":"More than 500 km"}]"
data-date-field="false" data-applied-prebind="true">

Distance Facet Range sample

What's Next for Me?