This arrived with the latest 5.1/5.2 Solr, so no, it won't work on 4.4, which is quite old by now.
As to how to do it on an older Solr, if you have the ability to do additional work at index time, create and entryDate_month field, which is truncated to the beginning of the month, then do a normal pivot facet on it. If you have a flow of content coming in that you cannot re-index, then they will effectively have an empty entryDate_month field, and won't show up in this pivot facet, but it won't otherwise break. Upayavira On Mon, Aug 17, 2015, at 11:38 PM, Lewin Joy (TMS) wrote: > Hi Yonik, > > Thank you for the reply. I followed your link and this feature is really > awesome to have. > But, unfortunately I am using solr 4.4 on cloudera right now. > I tried this. Looks like it does not work for this version. > Sorry, I forgot to mention that in my original mail. > > Thanks, > Lewin > > -----Original Message----- > From: Yonik Seeley [mailto:ysee...@gmail.com] > Sent: Monday, August 17, 2015 12:26 PM > To: solr-user@lucene.apache.org > Subject: Re: SOLR to pivot on date range query > > The JSON Facet API can embed any type of facet within any other type: > http://yonik.com/json-facet-api/ > > json.facet={ > dates : { > type : range, > field : entryDate, > start : "2001-...", // use full solr date format > end : "2015...", > gap : "+1MONTH", > facet : { > type:terms, > field:entryType > } > } > } > > -Yonik > > > On Mon, Aug 17, 2015 at 3:16 PM, Lewin Joy (TMS) <lewin_...@toyota.com> > wrote: > > Hi, > > > > I have data that is coming in everyday. I need to query the index for a > > time range and give the facet counts ordered by different months. > > For this, I just have a solr date field, entryDate which captures the time. > > > > How do I make this query? I need the results like below. > > > > Jan-2015 (2000) > > entryType=Sales(750) > > entryType=Complaints(200) > > entryType=Feedback(450) > > Feb-2015(3200) > > entryType=Sales(1000) > > entryType=Complaints(250) > > entryType=Feedback(600) > > Mar-2015(2800) > > entryType=Sales(980) > > entryType=Complaints(220) > > entryType=Feedback(400) > > > > > > I tried Range queries on 'entryDate' field to order the result facets by > > month. > > But, I am not able to pivot on the 'entryType' field to bring the counts of > > "sales,complaints and feedback" type record by month. > > > > For now, I am creating another field at index time to have the value for > > "MONTH-YEAR" derived from the 'entryDate' field. > > But for older records, it becomes a hassle. Is there a way I can handle > > this at query time? > > Or is there a better way to handle this situation? > > > > Please let me know. Any thoughts / suggestions are valuable. > > > > Thanks, > > Lewin > >