Gravatar for mskutta@onenorth.com

Question by Mike Skutta, Dec 8, 2016 10:04 AM

Coveo Pro Cloud V2 - Date Queries

Hello,

I am using the Content Browser in Coveo Cloud V2 to test queries. When I enter a date query against a Coveo date, such as "@date" or "@indexeddate", results come back as expected.

@date>=2016/10/08@00:00:00
@indexeddate>=2016/10/08@00:00:00

When I enter queries against custom date fields, the results do not appear to account for the date query.

@fentitydate90970>=2016/12/08@00:00:00

I have tried setting the date fields as "Sortable" only and have also tried setting them to both "Facet" and "Sortable", with the same results.

I am setting the format of the custom date fields to:

date.ToString("yyyy/MM/dd@HH:mm:ssZ")

Note: I am seeing the same behavior using the Sitecore IQueryable support. I am able to reproduce in the Cloud Content Browser.

Thanks, Mike

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Dec 8, 2016 10:44 AM

If you check the field definition, is it of type "date/time" or "String"?

Gravatar for mskutta@onenorth.com

Comment by Mike Skutta, Dec 8, 2016 11:00 AM

It is "String". Thanks, I missed that. I will switch it to "date/time".

https://developers.coveo.com/display/public/SitecoreV4/Creating+a+Computed+Date+Field

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Dec 8, 2016 11:09 AM

What is the exact DateTime of the item you expect to see in your second query? What is the date on your item when you check it in the Coveo Administration Console, under the "Content Browser" section?

The exact date format we are using is in the Coveo.Framework.Utils.DateTimeUtilities class, with the DateTime extension ToIndexFormat(). It first calls ToUniversalTime() and then formats it with .ToString("yyyy/MM/dd@HH:mm:ssZ", CultureInfo.InvariantCulture).

I suspect the output DateTime might not be in UTC, so the item might fall before the query you are trying to execute (December 08 at midnight). I don't know if it is intended, but note that your first query is not on the same date (October 8th instead of December).

I hope this helps :)

FLG

Ask a question