Coveo Distance Resources

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 Coveo JavaScript Search Framework DistanceResources component. This component is used to define options and register events to resolve the distance between the website visitor and results, where the website visitor coordinates are fetched using a position provider, and result coordinates are specified in Sitecore item latitude and longitude fields.

Usage notes

  • In your Sitecore items, you must indicate the latitude and longitude values in decimal degrees. The example item below shows proper latitude and longitude values for the Coveo Québec City office.

    Google maps data
  • After inserting the Coveo Distance Resources rendering, add one or several position provider renderings in the Distance Providers placeholder. The available position providers are: Coveo Google API Position Provider, Coveo Navigator Position Provider, and Coveo Sitecore Position Provider.

  • Position providers are resolved in order of appearance in the Distance Providers placeholder. If a position provider fails to return a position, the next provider is used as a fallback.

  • This rendering is typically used in combination with the Coveo Distance Sort rendering. In the Experience Editor, when no position provider rendering resolves the user position, the Coveo Distance Sort rendering caption is red and its tooltip message is Disabled. Please configure the distance resources component.

Insertion location

Coveo Hive

The Coveo Distance Resources rendering is an Allowed Control in the following placeholder(s): UI Header

Example insertion sequence for the Coveo Distance Resources rendering.

Coveo Hive SXA

Coveo for Sitecore SXA rendering insertion locations are not limited by placeholder Allowed Controls. The Coveo Distance Resources rendering may therefore be inserted throughout the partial design, whether in Coveo for Sitecore or Sitecore placeholders.

Example insertion sequence for the Coveo Distance Resources rendering.

Data source options

Option name Description

Latitude field

See the latitudeField component option.

Longitude field

See the longitudeField component option.

Unit type

Used to indicate the distance units. In effect, this sets the unitConversionFactor value required to convert the computed distance from meters to the selected unit type (see the unitConversionFactor component option).

Trigger a new query when a new position is set

See the triggerNewQueryOnNewPosition component option.

Cancel the query until the first position is resolved

See the cancelQueryUntilPositionResolved component option.

Distance field

See the distanceField component option.

DOM unique ID

Randomly generated HTML element ID.

Additional data attributes

Allows use of the Coveo JavaScript Search Framework DistanceResources component options that aren’t directly available in the data source.

Sample Generated HTML and Corresponding Visual Effect

<div id="coveo4288d73e" class="CoveoDistanceResources" data-prebind-distance-field="fieldTranslator"
data-distance-field="@fragma" data-prebind-latitude-field="fieldTranslator" data-latitude-field="@lat"
data-prebind-longitude-field="fieldTranslator" data-longitude-field="@long" data-unit-display-name="miles"
data-unit-conversion-factor="1610" data-applied-prebind="true">
Distance Resources Sample Results | Coveo for Sitecore 5