You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Charlie Maroto <ch...@gmail.com> on 2012/03/26 15:32:41 UTC
Using DateMath in Facet Label
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
Re: Using DateMath in Facet Label
Posted by Gora Sudindranath <go...@gmail.com>.
Have a look at
http://lucene.472066.n3.nabble.com/Tips-for-staggered-date-facets-i-e-last-24-hours-last-week-last-month-last-year-ala-google-news-td2066222.html
On Tue, Nov 27, 2012 at 9:16 AM, ksmith <ka...@gmail.com> wrote:
> Hi,
>
> i have a requirement to display solr facet like
>
> Today,
> Last Week,
> Last Month,
>
> so can you please help me how to display on frontend side like
>
> Today(5)
> Last Week (12)
> Last Month (3)
>
> i m using velocity on frontend side. i have confustion about facet field
> types and its value.
> how to manage its list to display above style.
>
> please reply asap.
>
> Thanks.
> Ksmith.
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Using-DateMath-in-Facet-Label-tp3858132p4022565.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: Using DateMath in Facet Label
Posted by ksmith <ka...@gmail.com>.
Hi,
i have a requirement to display solr facet like
Today,
Last Week,
Last Month,
so can you please help me how to display on frontend side like
Today(5)
Last Week (12)
Last Month (3)
i m using velocity on frontend side. i have confustion about facet field
types and its value.
how to manage its list to display above style.
please reply asap.
Thanks.
Ksmith.
--
View this message in context: http://lucene.472066.n3.nabble.com/Using-DateMath-in-Facet-Label-tp3858132p4022565.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Using DateMath in Facet Label
Posted by Charlie Maroto <ch...@gmail.com>.
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_lucene@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 <ch...@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
>
Re: Using DateMath in Facet Label
Posted by ksmith <ka...@gmail.com>.
Hi,
i have a requirement to display solr facet like
Today,
Last Week,
Last Month,
so can you please help me how to display on frontend side like
Today(5)
Last Week (12)
Last Month (3)
i m using velocity on frontend side. i have confustion about facet field
types and its value.
how to manage its list to display above style.
please reply asap.
Thanks.
Ksmith.
--
View this message in context: http://lucene.472066.n3.nabble.com/Using-DateMath-in-Facet-Label-tp3858132p4022569.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Using DateMath in Facet Label
Posted by Chris Hostetter <ho...@fucit.org>.
: 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