: I'm experimenting with date range faceting, and would like to use : different gaps depending on how old the date is. But I am not sure on : how to do that.
What you are trying to do is possible, but the SolrJ helper methods you are using predates the ability and doesn't currently work the way it should... : solrQuery.addDateRangeFacet("scheduledate_start_tdate", date1, date2, "+1YEAR"); : solrQuery.addDateRangeFacet("scheduledate_start_tdate", date3, date4, "+1MONTH"); the "addDateRangeFacet" method you are calling is just syntactic sugar for the "add(String,String)" method called on the various params: facet.range, facet.range.start, etc.... You can see that in the resulting URL you got the params are duplicated -- the problem is that when expressed this way, Solr doesn't know when the different values of the start/end/gap params should be applied -- it just loops over each of the facet.range fields (in your case: the same field twice) and then looks for a coorisponding start/end/gap value and finds the first one since there are duplicates. what you want to do can be accomplished (as of Solr 4.3 - see SOLR-1351) by using "local params" in the facet.range (or facet.date) params... http://localhost:8983/solr/select?q=*:*&rows=0&facet=true&facet.range={!facet.range.start=NOW/MONTH%20facet.range.end=NOW/MONTH%2B1MONTH%20facet.range.gap=%2B1DAY}manufacturedate_dt&facet.range={!facet.range.start=NOW/MONTH%20facet.range.end=NOW/MONTH%2B1MONTH%20facet.range.gap=%2B5DAY}manufacturedate_dt I've opened a new issue to track fixing these sugar methods -- patches to improve this would certainly be welcome, but note that it regardless of hte SolrJ behavior you'll need to upgrade to at least Solr 4.3 for the server side piece to work, and you cna work arround hte client side behavior by calling add(String,String) directly. https://issues.apache.org/jira/browse/SOLR-5443 -Hoss