Search webservice ignored time part on Write?

May 16, 2011 at 2:55 PM

Hi,

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 date part seems ignored.

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

Regards, Anita

 

Coordinator
May 16, 2011 at 8:42 PM

Anita:

I haven't tried anything like this. I haven't really had occasion to use the Search Web Service to this level of detail.

I think that you mean "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."?

M.

May 17, 2011 at 8:02 AM

Oww yes, ofcourse: time part seems ignored.
It isn't a SPServices thing, but a webservice thing, but a little bit strange behaviour.

Coordinator
May 17, 2011 at 12:48 PM

;-) Yes, it's definitely a Web Services thing. You might want to post the question over on SharePoint Overflow. I don't have any easy way to rig up a test.

M.

May 17, 2011 at 1:56 PM

I did: http://sharepoint.stackexchange.com/questions/12871/search-webservice-ignores-time-part-on-write

Coordinator
May 17, 2011 at 2:13 PM

Cool. I'll keep an eye on it, too.

M.

Jul 21, 2011 at 12:29 PM

I am trying to query a date range. Created date > AND < Created date .

as below

select Title, Path, Created from Scope() Where "Scope" = 'All Sites' AND Write>'2011-02-10'

when i use  "Write>" , it always works where as

select Title, Path, Created from Scope() Where "Scope" = 'All Sites' AND Write<'2011-05-10'

when i use "Write<", it fails with error "{Name cannot begin with '''character value hexdecimal value 0x27}

does the webservice support search < than?

Thanks in advance

Mar 13, 2013 at 8:35 PM
for jagkon's issue, I found that this can be solved by html encoding the <. e.g. AND Write &lt; '2010-01-01'