解决办法:
http://stackoverflow.com/questions/16935696/solr-facet-date-count-wrong
Tried date faceting in Solr 4.2.1 and it is not returning correct values. It has been deprecated like the wiki says. Instead I tried range faceting and it works fine: q=*:*&wt=json&rows=0&facet=true&facet.range=PRESENTDATE&facet.range.start=2011-12-01T00:00:00Z&facet.range.end=2012-06-01T23:59:59Z&facet.range.gap=%2B1MONTH
出现问题的原因是solr版本问题,solr3.1以上版本需要使用facet.range代替facet.date
solr官方wiki也有提到:
https://wiki.apache.org/solr/SimpleFacetParameters#Date_Faceting_Parameters
When using Date Faceting, the facet.date, facet.date.start, facet.date.end, and facet.date.gap params are all mandatory... NOTE: as of Solr3.1 Date Faceting has been deprecated in favor of the more general Range Faceting described below. The response structure is slightly different, but the functionality is equivalent (except that it supports numeric fields as well as dates)
时间: 2024-10-05 13:35:12