Thanks mats,

I missed this comparison

From: [email protected] 
[mailto:[email protected]] On Behalf Of Mats Stellwall
Sent: Wednesday, September 14, 2016 4:55 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] index for dateTime comparsion not working 
properly

Hi,

Is not 2016-09-14T06:04:00 greater than 2016-09-14T00:00:00?

So the 2016-09-14T06:04:00  <= 2016-09-14T00:00:00 will be false.

If you do 2016-09-14T23:59:59 as the maximum you would get a hit.

Kind regards,
Mats

Mats Stellwall
Principal Sales Engineer – Partners/Channels EMEA
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Cell: +46 70 604 55 11
www.marklogic.com<http://www.marklogic.com/>
Stay Connected

Follow me @MatsStellwall<http://twitter.com/MatsStellwall> on Twitter


Link with me Mats Stellwall<http://se.linkedin.com/in/matsstellwall/> at 
LinkedIn


Read my blogg at nosqlbloggen.se<http://nosqlbloggen.se/>





From: 
<[email protected]<mailto:[email protected]>>
 on behalf of "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Wednesday 14 September 2016 at 12:54
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] index for dateTime comparsion not working 
properly

Hi All,

DateTime index in not working properly  while writing json query. I have 
created element range index  for accessedTime.

Example: We have content like as.
{
"audit": {
"accessedTime": "2016-09-14T06:04:00",
"data": {
"entries": [
{
"name": "reportType",
"value": "Download"
}
]
},
"userName": "genuser",
"groups": {
"groupNames": [
"Test",
“Test2”
]
},
"identifier": "9695071722831412392"
}
}

When I am writing  a query like

  let $from-date := "2016-09-13T00:00:00"
  let $to-date := "2016-09-14T00:00:00"
  let $query := cts:and-query((
                           cts:json-property-range-query("accessedTime",">=", 
xs:dateTime($from-date)),
                           cts:json-property-range-query("accessedTime","<=", 
xs:dateTime($to-date))))
return cts:search(fn:doc(),$query)

Above query is not returning anything but when I am changing  to-date parameter 
to “2016-09-15T00:00:00”,  I am getting result. It looks like comparison is not 
working for operator “<=” .

Regards,
Vikas Singh
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to