Wouldn't it be easiest to compute the span at index time? Then it's very straight-forward.
Best, Erick On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰 <tom.tung....@gmail.com> wrote: > Hi, > > I'm new to Solr, and I'm having a problem with faceting. I would really > appreciate it if you could help :) > > I have a set of documents in JSON format, which I could post to my Solr > core using the post.jar tool. Each document contains two fields, namely > "startDate" and "endDate", both of which are of type "date". > > Conceptually, I would like to have a third field "timeSpan" that is > automatically generated from the return value of function query > "ms(endDate, startDate)", and do range facet on it, i.e. compute the > distribution of "timeSpan", among either all of or a filtered subset of the > documents. > > I have tried to find ways of both directly faceting the function return > values and automatically generate the "timeSpan" field during indexing, but > without luck yet. > > Suggestions are greatly appreciated! > > Best, > Yubing