Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

On my blog I got a question from Kanja Saha about the time part being ignored in a sql syntax query: http://www.itidea.nl/index.php/example-of-using-the-spservices-search-web-service/ I tested this on my environment and I couldn't get it to work. Test scenario: two queries, one without, one with Write:

var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>"
queryText += "<Query>"
queryText += "<Context>"
queryText += "<QueryText language='en-US' type='MSSQLFT'>"
queryText += "SELECT Title, Rank, Size, Description, Write, Path FROM Scope() WHERE
CONTAINS ('Deventer') ORDER BY \"Rank\" DESC"
queryText += "</QueryText>"
queryText += "</Context>"
queryText += "</Query>"
queryText += "</QueryPacket>";

var queryText2 = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>"
queryText2 += "<Query>"
queryText2 += "<Context>"
queryText2 += "<QueryText language='en-US' type='MSSQLFT'>"
queryText2 += "SELECT Title, Rank, Size, Description, Write, Path FROM Scope() WHERE
CONTAINS ('Deventer') AND Write>'2011-02-05T17:04:38Z' ORDER BY \"Rank\" DESC"
queryText2 += "</QueryText>"
queryText2 += "</Context>"
queryText2 += "</Query>"
queryText2 += "</QueryPacket>";

The first query returns:

title: Deventer - Write: 2011-02-05T17:04:38
title: Cities - Write: 2011-03-06T08:54:19
title: Deventer - Write: 2011-02-04T10:50:24
title: Deventer - Write: 2011-02-05T17:04:54
title: Deventer - Write: 2011-02-05T17:01:25
title: Deventer - Write: 2011-02-05T17:03:40

And the second:

title: Deventer - Write: 2011-02-05T17:04:38
title: Cities - Write: 2011-03-06T08:54:19
title: Deventer - Write: 2011-02-05T17:04:54
title: Deventer - Write: 2011-02-05T17:01:25
title: Deventer - Write: 2011-02-05T17:03:40

The date part functions as expected, the result with Write 2011-01-04 is gone in the second set of results, but the time part seems ignored.

Am I doing something wrong or has anybody experienced the same behaviour?

Regards, Anita

share|improve this question
    
Anita asked me this question on the SPServices site in the Discussions (spservices.codeplex.com/discussions/257785) but I didn't have a good, quick answer for her, so I suggested she post it here. –  Marc D Anderson May 17 '11 at 12:59
    
I am almost positive I tried getting this working before (and failed). I'm very interested to know the answer to this question. –  Kit Menke May 17 '11 at 18:41
add comment

2 Answers 2

It may not be that the time part is ignored, but that there is an adjustment for timezone going on, and that that leaves the unexpected results.

What timezone is this query being run in? The query specifies a UTC time, but the results don't seem to be. Also, has the server been configured to automatically adjust for daylight saving? I've found problems when it wasn't set to.

http://www.novolocus.com/2008/05/21/the-curious-incident-of-the-date-column-in-the-night-time/

share|improve this answer
    
Thanks for pointing out the timezone and the different places to set the time settings. server's time setting: UTC+1, daylight saving set Site's regional settings: UTC+1 web application: UTC+1 There is indeed a time difference between items in the list and the items returned by the search, the difference is one hour: item in list: Last modified at 2/5/2011 6:01 PM item from search: Write: 2011-02-05T17:01:25 Due to UTC+1 Adjusting the query with this hour didn't work so a few extra hours: AND Write>'2011-02-05T23:00:00Z' But this didn't work either. –  Anita Boerboom May 18 '11 at 7:12
    
Then all I can think is that you're right, and the time element is being ignored, which is surprising. I can't see anything wrong with your logic. –  Andy Burns May 18 '11 at 8:23
    
It's surprising indeed, hope it will be fixed... –  Anita Boerboom May 18 '11 at 8:34
    
Unfortunately, the Web Services seem to be a backwater. I don't know that anyone at Microsoft pays any attention to the problems with them, though I am trying my damndest to figure out how to make it happen. I'd suggest that you add something in the Commmunity Content here msdn.microsoft.com/en-us/library/search.queryservice.query.aspx just to register the issue. –  Marc D Anderson May 18 '11 at 14:42
    
Thanks for the suggestion, I posted it (twice by accident, so it can't be ignored :) ) –  Anita Boerboom May 18 '11 at 19:27
add comment
up vote 0 down vote accepted

Posted to http://msdn.microsoft.com/en-us/library/search.queryservice.query.aspx Not an actual answer, but an answer for now: it can't be done.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.