Thanks, I'm going to try that !
But <DUH>  I found 2/3 my problem.

1) I had my datetime fields in the wrong timezone !  (+08:00 instead of -08:00 
serves me right for taking a shortcut and hard-coding the timezone in the data 
loading instead of calculating it)
2) One of my servers was set to UTC instead of the local zone I wanted ...

Regenerating the data and we'll see how far that gets me !

Thanks for the idea on a custom anchor though, that will come into great use !


----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]<mailto:[email protected]>
812-482-5224

From: [email protected] 
[mailto:[email protected]] On Behalf Of Micah Dubinko
Sent: Monday, July 25, 2011 6:32 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Timezone specific "today" with computed 
buckets in search:search

I could be completely misremembering this, but you should try a custom anchor. 
(off the top of my head)

<anchor name="mycustom-anchor" apply="fname" ns="http://namespace"; 
at="path/to/module.xqy"/>

The function will get the datatype as a string, and should return a value of 
that datatype with whatever kind of timezone conversions you want.

-m

On Jul 25, 2011, at 3:13 PM, Lee, David wrote:


I'm experimenting with date range computed buckets.
My range index is xs:dateTime and I want to define  "today" , "last 15 minute" 
, "yesterday"

I got this to sorta work ...


<constraint name="date">
    <range type="xs:dateTime">
      <element ns="http://www.epocrates.com/schemas/logs";
               name="log"/>
      <attribute ns="" name="time"/>
      <computed-bucket name="today" ge="P0D" lt="P1D"
       anchor="start-of-day">Today</computed-bucket>
      <computed-bucket name="yesterday" ge="-P1D" lt="P0D"
       anchor="start-of-day">yesterday</computed-bucket>
      <computed-bucket name="15min" ge="-PT15M" lt="PT0M"
       anchor="now">Last 15 minutes</computed-bucket>
    </range>
  </constraint>


The problem is the meaning of "start-of-day" seems to be GMT not my local 
timezone.
Is there a way to force the meaning of     'anchor="start-of-day"' to mean 
start of day in a specific timezone ?

Thanks for any hints

-David


----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]<mailto:[email protected]>
812-482-5224

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to