Hi Chris, c) would cover the last year to the current date, therefore, as I write this it would be the period between Apr11, 2011 and Apr 10, 2012. Therefore, the period begin and end dates would increase by one day tomorrow. d) represents the current calendar year, thus covering Jan 1, 2012 - Apr 10, 2012 (at the moment of writing this reply).
Thanks for your suggestion, that was pretty much what we did around the time of sending the email but we were hoping to find a way to make it more dynamic out of Solr. Carlos ________________________________________ From: Chris Hostetter [hossman_luc...@fucit.org] Sent: Tuesday, April 10, 2012 12:40 PM To: solr-user@lucene.apache.org Subject: Re: Using DateMath in Facet Label : a) Last Week : b) Last Month : c) Last Year : d) 2012 : e) 2011 or earlier ... : Of course, as 2013 rolls in, then the labels for the last two buckets : should change to “2013” and “2012 or earlier”. Is there any way to have : Solr return the correct year based on the current date? For example, I first off: i don't understand how #c and #d are different -- but to answer your question, no. my suggestion would either be to use simple keys that your front end then uses to "translate" into what it displays to the user (ie: "curr_week", "curr_month", "curr_year", "last_year", "old") or just have your front end app "parse" the date math expressions itself. -Hoss On Mon, Mar 26, 2012 at 6:32 AM, Charlie Maroto <charlie.mar...@gmail.com>wrote: > Hi, > > > > We have a requirement to facet on a field with a date value so that the > following buckets are shown: > > > > a) Last Week > > b) Last Month > > c) Last Year > > d) 2012 > > e) 2011 or earlier > > > > Of course, as 2013 rolls in, then the labels for the last two buckets > should change to “2013” and “2012 or earlier”. Is there any way to have > Solr return the correct year based on the current date? For example, I > thought of trying to do something like this for d) above: > > > > …&facet.query={!key=[NOW-1YEAR/YEAR]}date_entered:[NOW-1YEAR/YEAR TO > NOW/YEAR]... > > > Thanks, > Carlos >