Gravatar for

Question by dwebb, Dec 3, 2014 12:46 PM

Coveo Datetime slider does not render properly

Hi - I am trying to set up a Coveo facet on a datetime field, using the Coveo Facet Date Slider. I believe I have the underlying data fields and facets configured correctly, but the slider does not render properly. I am using a fictitious "News Release" template, with a "News Release Datetime" field.

I added a DateTime field to my template, called "NewsReleaseDatetime".

I then added 4 news release content pages based on this template. Each one has a different datetime in it (ranging from Nov 1 2013 to Mar 1 2014). I published those documents and they appear in the Coveo master and web indexes. When I inspect the fields of those indexed documents in the Coveo admin tool, the values appear as I would expect (eg. "1/1/2014 6:00:00 AM").

I then added a new Facet definition in Sitecore to System -> Settings -> Buckets -> Facets. I specified Name and Field name (newsreleasedatetime). I did not specify a facet filter. All other settings are defaults.

I then published the facet definition to Coveo (and the field in the Coveo index is now correctly marked as a facet).

I then edited the Search Results page and added a Coveo Facet Date Slider to the facet area of a search results page. The field is "News Release Datetime" (selected from the available field dropdown). I checked "automatically generate slider range" and did not specify minimum and maximum dates. All other settings were left as the defaults.

The rendering does not look as I expect - it has 2 wide bars (of unequal heights). The title of the webpart rendering the dates (below the bar chart) says "1969/12/31 - 1969/12/31". Hovering over the left bar shows a tooltip of "1969/12/31 - 1969/12/31 2" (2 being the # of results). Hovering over the right bar shows a tooltip of "1969/12/31 - 1969/12/31 1" (1 being the # of results).

It looks as though the rendering is not retrieving the data values properly from the index, since there are no dates of Dec 31 1969 in my content. It also appears that the # of results is wrong, as it is showing 2 and 1 results, whereas there are actually 4 results on the search page.

Any help would be greatly appreciated.

2 Replies
Gravatar for

Answer by Vincent Séguin, Dec 3, 2014 2:09 PM

Hi David,

Did you reindexed the news release after setting the facet definition?

Gravatar for

Comment by dwebb, Dec 3, 2014 2:53 PM

Hi Vincent -- yes, I had been advised that I would need to rebuild the index completely after defining a facet.

Just to be safe, I just now rebuilt all 3 indexes (master, web, core) from the Sitecore interface (using the Developer tab -> Rebuild Index). I then waited for all the indexing to happen in the Coveo admin tool.

The slider is still rendering exactly the same as before.

Gravatar for

Answer by Sébastien Belzile, Dec 3, 2014 3:42 PM

Hi David,

This is a known issue that was fixed with December14 release. It is due to the data-date-field="true" attribute not being declared to the right place in the generated html.

A way around would could be moving it using jQuery. In the file CoveoFacetSlider.ascx, you should see the following line : var facetOptions = <%= Model.GetJavaScriptInitializationOptions() %>; The options generated is a normal json object having the form : facetOptions = { [YourSliderUniqueId] : { Slider : { dateField : true } } }

The call dateField : true should be to the level of Slider, like this :

facetOptions = { [YourSliderUniqueId] : { dateField : true, Slider : { [OtherOptions] } } }

Step 1 : Remove the option dateField : true using the jquery call delete facetOptions.[YourSliderUniqueID].Slider.dateField

Step 2 : add it to the right place : facetOptions.[YourSliderUniqueId].dateField = true

Gravatar for

Comment by dwebb, Dec 3, 2014 4:07 PM

Hi Vincent - ok, that made a difference, but maybe something is wrong with the values.

I overrode the facetOptions to this:

facetOptions = {"@fnewsreleasedatetime69473":{"title":"Datetime","field":"@fnewsreleasedatetime69473","uniqueId":"@fnewsreleasedatetime69473","enableCollapse":false,"enableSettings":true,"includeInBreadcrumb":true,"injectionDepth":1000,"dateField":true,"slider":{"dateFormat":"yyyy/MM/dd","rangeSlider":false,"steps":5,"excludeOuterBounds":false,"displayAsValue":{"unitSign":"","separator":"-"}}}}

Now the date range is rendering as 1401/01/01 - 2015/01/01 (and one bar).

Gravatar for

Comment by Sébastien Belzile, Dec 3, 2014 5:15 PM


The problem is due to a bug that is currently being fixed.

Alternative solutions

  • It works when the field is filled on every item with the template.
  • It works when using fixed ranges.
Gravatar for

Comment by dwebb, Dec 4, 2014 1:31 PM

Hi Vincent -- ok, I will hold tight for an update from you.

One thing I noticed is that the problem so far is only in Preview mode (when the page being edited in Sitecore). Just to try something, I published the page. In the published version, the facet displays valid data, but it doesn't display as a slider - it looks more like a regular string facet, where it shows 3 date ranges with checkboxes (which are correct -- Nov 01 2013 - Feb 01 2014 with 2 items, Feb 01 2014 - May 01 2014 with 2 occurrences, and Nov 01 2014 - Feb 01 2015 with 1 occurrence).

Just thought I'd let you know.

Ask a question