Hi David,

You saw my earlier post on how to use the query itself to add dynamically 
generated date buckets. You could take the same approach here. Assume there is 
only one start_date and one end_date constraint, and use those as values for ge 
and lt attribute on the bucket.

http://markmail.org/message/4wmgyjocja44si56

Note: you can a range indexes for multiple types on the same element, so you 
could add xs:time, xs:date and xs:dateTime indexes for that field, allowing you 
to either filter on date, time or date+time. The first pattern would match the 
xs:date index (saving you the trouble adding time to them), the latter 
xs:dateTime..

Kind regards,
Geert

Van: [email protected] 
[mailto:[email protected]] Namens Lee, David
Verzonden: dinsdag 20 september 2011 19:58
Aan: General MarkLogic Developer Discussion
Onderwerp: Re: [MarkLogic Dev General] Suggestion/Help for date range in 
search:search constraint

Realized my question may not be obvious.
To clarify:  I'd like to use a search:search string like

                "start_date:2011-09-10 end_date:2011-09-15"

Or possibly with datetime
                "start_date:2011-09-10T01:00:00Z end_date:2011-09-15T12:12:12Z"

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

From: 
[email protected]<mailto:[email protected]>
 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
 On Behalf Of Lee, David
Sent: Tuesday, September 20, 2011 1:38 PM
To: General Mark Logic Developer Discussion 
([email protected]<mailto:[email protected]>)
Subject: [MarkLogic Dev General] Suggestion/Help for date range in 
search:search constraint

I'm trying to implement a date range constraint in search:search.

So far I have a computed bucket range that is working as per the examples
so I can specify, for example:
                date:today

But I'd like to add start_date and end_date as options and cant quite get it.

The field I have is a dateTime field.

My "date" contraint looks like this:

<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" le="PT0M"
       anchor="now">Last 15 minutes</computed-bucket>
             <computed-bucket name="30min" ge="-PT30M" le="PT0M"
       anchor="now">Last 30 minutes</computed-bucket>
    </range>
</constraint>

Any suggestions on how to make a "start_date" and "end_date" constraint ?

Thanks for any suggestions or pointers to docs.



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

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

Reply via email to