search · SharePoint2013 · unnikannan

SharePoint 2013 Search Query (KQL) fails for DateTime properties

Recently I faced with this weird issue when one of my customers reported an issue in one of content search web part. For that user the content search web part would throw the below error:


Interestingly this issue was not reproducible in my machine and so I started checking the logs and found the below error message:

System.ServiceModel.FaultException`1[Microsoft.Office.Server.Search.Administration.SearchServiceApplicationFault]: Query ‘Type:5ab295f9-9aed-4cdf-aa05-fbb693fc85e9 AND DateProperty:12/31/2014..12/30/2015′ failed: syntax error at position 56, Unable to parse ’12/31/2014’ as an absolute date time value. 

The error message stated that “12/31/2014” could not be parsed as a valid date time value.

Then I got to know that the user who reported the issue has Portuguese as default browser language and I tried setting up the same in my browser. Voila, the issue got reproduced. Then I checked for most of the other languages such as Russian, Dutch, Chinese, Italian etc. and most of them failed. So tracing the issue in fiddler and little bit of googling, I found that client.svc actually uses the locale of the client browser while parsing the values (you could see the client browser language is send in the Request Header in below screenshot).


Accept-Language: pt-PT, en-GB;

The date value is sent in mm/dd/yyyy format by me and it is not supported by many of the non-English language cultures. So after some googling I found that International date format is yyyy-mm-dd, so this format would be supported by all of the cultures. And so I changed my query to use yyyy-mm-dd date format of value i.e.: DateProperty: 2014-12-31..2015-12-30 and it worked!! (Also yyyy/mm/dd format also works)

Then I did some testing with different browser language culture and this format worked for most of the European languages but failed for Chinese. For users with Chinese browser language , the search did not return any results (no error as well 😦 )

Update: For Chinese browser language , the date range query works for yyyy-mm-dd or yyyy/mm/dd date format.

3 thoughts on “SharePoint 2013 Search Query (KQL) fails for DateTime properties

  1. Hi Stefan,
    That date range issue is no longer existing for Chinese browser language. I think some subsequent CU update fixed it for me. My machine was almost 1 year behind in CU(Currently in Sept 2015 CU). So yes for Chinese browser language the yyyy/mm/dd or yyyy-mm-dd should work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s