: 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>
        ...
: 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 )

Be careful here, you need to consider what happens when your new code 
interacts with per field overrides (ie: date faceting on multipe date 
fields) which is currently supported...

        facet.date.gap = +1DAY
        facet.date = begin_df
        f.begin_df.date.start = NOW/DAY-10DAY
        f.begin_df.date.end = NOW/DAY+1DAY
        facet.date = finish_df
        f.finish_df.date.start = NOW/DAY
        f.finish_df.date.end = NOW/DAY+10DAY

...note that people can mix and match, some fields may have specific 
values for some params, but other fields might get the "common" param 
value.  

(Ideally people should be able to do the same type of "field" specific 
override for certain instances of the faceting on a specific field.)

We've discussed how hard something like this would be on the list before, 
but your post has got me thinking about it again...

What would probably work a bit cleaner then trying to do parallel array 
walking of the various params, would be to borrow the "key" syntax yonik 
introduced with field faceting, and do something similar...

        facet.date.gap = +1MONTH
        facet.date = {!key=begin_month}begin_df
        f.begin_month.date.start = NOW/MONTH-1YEAR
        f.begin_month.date.end = NOW/MONTH+1MONTH
        // begin_month inherits facet.date.gap
        facet.date = {!key=begin_day}begin_df
        f.begin_day.date.start = NOW/DAY-1MONTH
        f.begin_day.date.end = NOW/DAY+1DAY
        f.begin_day.date.gap = +1DAY
        facet.date = {!key=finish_month}begin_df
        f.finish_month.date.start = NOW/MONTH
        f.finish_month.date.end = NOW/MONTH+1YEAR
        // finish_month inherits facet.date.gap
        facet.date = {!key=begin_day}begin_df
        f.finish_day.date.start = NOW/DAY
        f.finish_day.date.end = NOW/DAY+1MONTH
        f.finish_day.date.gap = +1DAY

..that would also solve the ambiguity of the output -- because they "key" 
can be used as the key in the  facet_dates NamedList.

what do you think?



-Hoss

Reply via email to