I have an event table which has start date and end date like this
==============================================
id | name | start_date | end_date
==============================================
1 | Test Event 1 | 2011-11-20 | 2011-12-20
----------------------------------------------
2 | My Event 2 | 2011-12-05 | 2011-12-26
----------------------------------------------
3 | My Event 3 | 2012-12-26 | 2012-01-11
----------------------------------------------
Now I want to have a solr facet which looks like this and i can't seem to get the params right.
==================
Dates
------------------
Today [2]
This Week [2]
This Month [2]
Next Month [1]
Please note that the facet has to consider both start date and end date. Sort of gouping ?
What should be the faceting parameters for this ?
Thanks in advance for any help.
I finally got it working using solarium libraries Facet Multi Query based on the example http://wiki.solarium-project.org/index.php/V2:Facet_multiquery
The part in my Zend App looks like
$dateFacetSet = $query->getFacetSet();
$dateFacet = $dateFacetSet->createFacetMultiQuery('dates');
$dateFacet->createQuery('Today', 'type:event AND sdate:[* TO NOW/DAY] AND edate:[NOW/DAY TO * ]');
$dateFacet->createQuery('This-Week', 'type:event AND sdate:[* TO ' . $this->view->date_w["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_w["start"] . 'T00:00:00Z TO * ]');
$dateFacet->createQuery('This-Month', 'type:event AND sdate:[* TO ' . $this->view->date_m["end"] . 'T23:59:59Z] AND edate:[' . $this->view->date_m["start"] . 'T00:00:00Z TO * ]');
If anyone wants to know more, please let me know.
These params catch what i needed so far but haven't tested extensively.