Thnx Micah, that was the missing piece! Pity there isn't an example. Neither in the Search dev guide (http://docs.marklogic.com/4.2doc/docapp.xqy#display.xqy?fname=http://pubs/4.2doc/xml/search-dev-guide/search-api.xml) nor in the API docs (http://developer.marklogic.com/pubs/4.2/apidocs/SearchAPI.html).
Kind regards, Geert Van: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] Namens Micah Dubinko Verzonden: woensdag 21 september 2011 6:48 Aan: General MarkLogic Developer Discussion Onderwerp: Re: [MarkLogic Dev General] Suggestion/Help for date range in search:search constraint David, I don't know that I've fully internalized your use case. But if you had a range constraint against a dateTime-typed range index, and used the new comparison operators in 4.2, you could do something like this: [date GT 2011-09-10T01:00:00Z AND date LT 2011-09-15T12:12:12Z] GT and LT (and AND) are all defined in the default 4.2 grammar. No need or benefit from having the start and end constraints be differently-defined. -m On Sep 20, 2011, at 2:35 PM, Lee, David wrote: Thanks. I was hoping something easier would have presented itself by now. Also thinking of separating the start/end date out of the search string as it will not really be entered 'by users' so could be passed in as a seperate parameter which becomes an additional searchable expression constraint. ---------------------------------------- David A. Lee Senior Principal Software Engineer Epocrates, Inc. d...@epocrates.com<mailto:d...@epocrates.com> 812-482-5224 From: general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com> [mailto:general-boun...@developer.marklogic.com]<mailto:[mailto:general-boun...@developer.marklogic.com]> On Behalf Of Geert Josten Sent: Tuesday, September 20, 2011 2:09 PM To: General MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Suggestion/Help for date range in search:search constraint 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: general-bounces@develop<mailto:general-boun...@developer.marklogic.com>er.marklogic.com<mailto:general-boun...@developer.marklogic.com> [mailto:general-boun...@developer.marklogic.com]<mailto:[mailto:general-boun...@developer.marklogic.com]> 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. d...@epocrates.com<mailto:d...@epocrates.com> 812-482-5224 From: general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com> [mailto:general-boun...@developer.marklogic.com]<mailto:[mailto:general-boun...@developer.marklogic.com]> On Behalf Of Lee, David Sent: Tuesday, September 20, 2011 1:38 PM To: General Mark Logic Developer Discussion (general@developer.marklogic.com<mailto:general@developer.marklogic.com>) 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. d...@epocrates.com<mailto:d...@epocrates.com> 812-482-5224 _______________________________________________ General mailing list General@developer.marklogic.com<mailto:General@developer.marklogic.com> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general