Hey there,
I needed to have a multiple date facet functionality. Like say for example
to show the latests results in the last day, last week and last month. I
wanted to do it with just one query. 
The date facet part of solrconfig.xml would look like:

      <str name="facet.date">date_field</str>
      <str name="facet.date.start">NOW/DAY-1DAY</str>
      <str name="facet.date.start">NOW/DAY-7DAY</str>
      <str name="facet.date.start">NOW/DAY-30DAY</str>

      <str name="facet.date.end">NOW/DAY+1DAY</str>
      <str name="facet.date.end">NOW/DAY+1DAY</str>
      <str name="facet.date.end">NOW/DAY+1DAY</str>

      <str name="facet.date.gap">+2DAY</str>
      <str name="facet.date.gap">+8DAY</str>
      <str name="facet.date.gap">+31DAY</str>

What I have done to have it working is do some changes at
getFacetdateCounts() in SimpleFacets.java

Instead of getting start,end and gap params as String I get them as array of
strings. 
I would have 3 array. In the first position of each would have the first
start, the first ends and the firs gap. Same for the second and thirth( in
my example )
Once I have them I do exactly what the function did before but for every
position of the array.

The resultant output looks like this:

<lst name="facet_dates">
  <lst name="date_field">
    <int name="2009-04-27T00:00:00Z">21</int>
    <str name="gap">+2DAY</str>
    <date name="end">2009-04-29T00:00:00Z</date>
    <int name="2009-04-21T00:00:00Z">86</int>
    <str name="gap">+8DAY</str>
    <date name="end">2009-04-29T00:00:00Z</date>
    <int name="2009-03-29T00:00:00Z">316</int>
    <str name="gap">+31DAY</str>
    <date name="end">2009-04-29T00:00:00Z</date>
  </lst>
</lst>

I am doing it just for testing. This works for me but maybe would be
confusing to parse the output for other examples (let's say when you need to
repeat the gap to cover all the range).

Does someone think that could be good to have this functionality? In case
yes I could post what I have and do it in the right way it in case someone
points me in the right direction.

Thanks in advance

-- 
View this message in context: 
http://www.nabble.com/Multiple-Facet-Dates-tp23272868p23272868.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to