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 Raphaël Droz <ra...@gmail.com> on 2010/08/05 09:59:33 UTC

Multiple Facet Dates

Hi,
I saw this post : 
http://lucene.472066.n3.nabble.com/Multiple-Facet-Dates-td495480.html
I didn't see work in progress or plans about this feature on the list 
and bugtracker.

Does someone already created a patch, pof, ... I wouldn't have been able 
to find ?
 From my naïve point of view the ratio "usefulness" / "added code 
complexity" appears as high.

My use-case is to provide, in one request :
- the results count for each one of several years (tag-based exclusion)
- the results count for each month of a given year
- the results count for each day of a given month and year)

I pretty sure someone here already encountered the above, isn't ?

Re: Multiple Facet Dates

Posted by Raphaël Droz <ra...@gmail.com>.
On 05/08/2010 09:59, Raphaël Droz wrote:
> Hi,
> I saw this post : 
> http://lucene.472066.n3.nabble.com/Multiple-Facet-Dates-td495480.html
> I didn't see work in progress or plans about this feature on the list 
> and bugtracker.
>
> Does someone already created a patch, pof, ... I wouldn't have been 
> able to find ?
> From my naïve point of view the ratio "usefulness" / "added code 
> complexity" appears as high.
>
> My use-case is to provide, in one request :
> - the results count for each one of several years (tag-based exclusion)
> - the results count for each month of a given year
> - the results count for each day of a given month and year)
>
> I pretty sure someone here already encountered the above, isn't ?
After having understood :
"This parameter can be specified on a per field basis."
I created 3 more copy-fields, it's then obvious :

// the real constraint requested
fq={!tag=datefq}date
f.date.facet.date.start=2008-12-08T06:00:00Z
f.date.facet.date.end=2008-12-09T06:00:00Z
f.date.facet.date.gap=+1DAY

// three more field for the total
facet.date={!ex%3Ddatefq}date_for_year
facet.date={!ex%3Ddatefq}date_for_year_month
facet.date={!ex%3Ddatefq}date_for_year_month_day

// the count for all year without the constraint
f.date_for_year.facet.date.start=1970-01-01T06:00:00Z
f.date_for_year.facet.date.end=2011-01-01T06:00:00Z
f.date_for_year.facet.date.gap=+1YEAR

// the count for all month of the year requested (2008) without the 
constraint
f.date_for_year_month.facet.date.start=2008-01-01T06:00:00Z
f.date_for_year_month.facet.date.end=2008-12-31T06:00:00Z
f.date_for_year_month.facet.date.gap=+1MONTH

// idem for the days...

Thanks for your work !

Raph