if "type" is a field use field faceting with an fq q=datefield:[start TO end]&fq=type:(a b c)&facet.field=type
On 14 January 2012 17:56, Jamie Johnson <jej2...@gmail.com> wrote: > I'm trying to figure out a way to execute a query which would allow me > to say there were x documents over this period of time with type a, y > documents over the same period of time with type b and z documents > over the same period of time with type c. I was thinking of doing > this using range faceting where I'd execute 3 separate queries of the > form: > > solr/select?q=type:a&facet.range=datefield&facet.start=NOW-1YEAR&facet.end=NOW > solr/select?q=type:b&facet.range=datefield&facet.start=NOW-1YEAR&facet.end=NOW > solr/select?q=type:c&facet.range=datefield&facet.start=NOW-1YEAR&facet.end=NOW > > ideally I'd like to do this in a single request. Is this possible? > I'm thinking about something like this > > q=*:*&fq={!tag=a}-type:(b c)&fq={!tag=b}-type:(a > b)&fq={!tag=c}-type:(a b)&facet=on&facet.field={!ex=a > key=a_datefield}datefield&facet.field={!ex=b > key=b_datefield}datefield&facet.field={!ex=c > key=c_datefield}datefield&facet.start=NOW-1YEAR&facet.end=NOW > > Should I consider trying to do this or is it better to do this some > other way (separate queries or any other ideas?) for performance > reasons? Am I over complicating the issue be trying to do this in one > shot? > > Any thoughts would be greatly appreciated.