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 adfel70 <ad...@gmail.com> on 2014/11/16 09:38:21 UTC

Is it possible to facet on date fields and aggregate by day/month/year?

Hi,

If my data includes:
doc1: date_f: 2014-05-01T00:00:00Z
doc2: date_f: 2014-05-02T00:00:00Z
doc2: date_f: 2014-06-01T00:00:00Z
doc2: date_f: 2014-07-01T00:00:00Z

then I can facet on month(date_f) and get
05(2)
06(1)
07(1)
or facet on year(date_f) and get 
2014(4)


Is it supported?




--
View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-facet-on-date-fields-and-aggregate-by-day-month-year-tp4169366.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is it possible to facet on date fields and aggregate by day/month/year?

Posted by Erick Erickson <er...@gmail.com>.
Look at the range faceting stuff. It lets you
specify a start date, end date and gap. And
you can get results for multiple instances
on the same field.

So you could specify one set of parameters
for date_f where the gap was +1MONTH
and another on date_f was +1YEAR.

See:
https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-RangeFaceting

Best,
Erick

On Sun, Nov 16, 2014 at 12:38 AM, adfel70 <ad...@gmail.com> wrote:
> Hi,
>
> If my data includes:
> doc1: date_f: 2014-05-01T00:00:00Z
> doc2: date_f: 2014-05-02T00:00:00Z
> doc2: date_f: 2014-06-01T00:00:00Z
> doc2: date_f: 2014-07-01T00:00:00Z
>
> then I can facet on month(date_f) and get
> 05(2)
> 06(1)
> 07(1)
> or facet on year(date_f) and get
> 2014(4)
>
>
> Is it supported?
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-facet-on-date-fields-and-aggregate-by-day-month-year-tp4169366.html
> Sent from the Solr - User mailing list archive at Nabble.com.