Configure Custom Ranges for Range Facets

Warning
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.

Using range facets enables users to easily filter results based on numeric and date field values. Coveo for Sitecore can automatically generate ranges based on the minimum and maximum values entered in the target Sitecore field and the number of facet values you want, among other parameters.

However, you might prefer setting up custom ranges that make more sense in your specific context.

This article provides step-by-step instructions on how to create custom ranges for your numeric range and date range facets.

Note

The instructions below pertain to a date range facet. However, the Coveo Hive Custom Ranges Parameters folder contains template items associated with numeric ranges that let you implement custom numeric ranges in the same manner, whether for traditional range facets or for dynamic range facets.

To configure custom date ranges for a date range facet

  1. Add the target Sitecore date field to the list of fields to index (see About the Indexing Manager - Fields).

  2. Make the target Sitecore date field facetable by editing Coveo.SearchProvider.Custom.config and performing an indexing action (see Make a Sitecore Field Facetable).

  3. In the Sitecore Content Editor, right-click an item in the content tree where you want to add the custom ranges and select Insert > Insert from template.

  4. Under Coveo Hive > Custom Ranges Parameters, select Custom Date Ranges.

  5. In the Insert from Template dialog, change the Item Name to something meaningful like YearRanges.

  6. Right-click the item created in step 5 and select Insert > Date Range.

  7. Give your new Date Range item a meaningful name.

  8. In the Basic Settings section of your Date Range item, set values for the following fields:

    • Start

    • End

    • Label: The value in this field will be associated to a facet value caption in the date range facet data source. Only use letters and numbers for the value of this field.

    • End inclusive: In the example below, End inclusive is unchecked to make the ranges mutually exclusive and to avoid any time gaps between ranges.

    Date range item settings | Coveo for Sitecore 5
  9. Repeat steps 6 to 8 to create all required date ranges.

  10. Open your search page in the Sitecore Experience Editor.

  11. Add a new Coveo Date Facet Range rendering in your search interface, if not already done.

    1. In the Main Section placeholder, add a Facets Section.

    2. In a Facets Section Facets placeholder, add a Coveo Date Facet Range.

    3. In the Select the Associated Content dialog, create a new data source for your Coveo Date Facet Range rendering.

  12. Select the Coveo Date Facet Range rendering to which you want to associate your date ranges.

  13. In the floating toolbar, select the Edit the rendering’s data source option. It should be the leftmost option in the toolbar.

  14. In the Basic Settings section, set values for the following fields:

    • Title: Use this field to specify the caption of your facet.

    • Field: Use the Select Field link to select the target Sitecore field you made facetable in the first steps of this procedure.

    • Facet Name

    • Sort: Select the sorting order for your date ranges. Sorting is based on your Date Range items Label field values.

    DateFacetRangeBasicSettings
  15. In the Range Settings section, under Select Ranges, select your Custom Date Ranges item created earlier.

    DateFacetRangeRangeSettings
  16. Click OK.

    You should now have a Coveo Date Facet Range displaying your Date Range item Label field values in your search interface.