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 Simon Fairey <si...@gmail.com> on 2014/10/17 17:13:17 UTC

Variable date range facets and fixed range labels

Hi

 

I'm trying to get solr (4.10) doing more of what it does best rather than a
lot of hacking that is currently in our front end code, one area I'm trying
to fix is date ranges, I have 2 types of date and want to display them in 2
different ways:

 

dateA - blocks of 25 years, this works but only gives me one of the boundary
values rather than say, "1989 to 2014 - 600,000", I get "1989 - 600,000". Is
there any way for it to return the years at either side of the boundary,
can't seem to find an option that will do it.

 

                        <str name="facet.range"> dateA </str>

                        <str name="f.
dateA.facet.range.start">NOW/YEAR-100YEARS</str>

                        <str name="f.
dateA.facet.range.end">NOW/YEAR-25YEARS</str>

                        <str name="f. dateA.facet.range.gap">+25YEARS</str>

                        <str name="f. dateA.facet.range.other">all</str>

 

dateB - increasing range size say 1,5,10,25 years starting from NOW, I tried
the below but it barfed, also tried with +xYEARS and that failed too:

 

                        <str name="facet.range"> dateB </str>

                        <str name="f.
dateB.facet.range.start">NOW/YEAR-116YEARS</str>

                        <str name="f.
dateB.facet.range.end">NOW/YEAR-1YEAR</str>

                        <str name="f.
dateB.facet.range.gap">!YEAR,5YEARS,10YEARS,25YEARS</str>

                        <str name="f. dateB.facet.range.other">all</str>

 

Error is - Can't add gap !YEAR,5YEARS,10YEARS,25YEARS to value Sat Jan 01
00:00:00 GMT 1898 for field: DOCVARIOUSDATES

 

Cheers

 

Si