THIS IS ARCHIVED DOCUMENTATION

Configuring Custom Ranges for a Date Range or Numeric Range Facet

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.

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 allow you to implement custom numeric ranges in the same manner.

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 Understanding the Indexing Manager - Fields).
  2. Make the target Sitecore date field facetable by editing Coveo.SearchProvider.Custom.config and performing an indexing action (see Making 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.

  9. Repeat steps 6 - 8 to create all required date ranges.
  10. Open your search page in the Sitecore Experience Editor.
  11. If not already done, add a new Coveo Date Facet Range component in your search interface.
    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 component.
  12. Select the Coveo Date Facet Range component 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.

  15. In the Results Scope section, under Facet value caption, associate your Date Range item Label field values (in the left column) to actual facet value captions (in the right column).

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

  17. Click OK.

    You should now have a Coveo Date Facet Range component with your custom ranges and range captions in your search interface.