I have tried and failed. So to the best of my knowledge, no it isn't
possible to do such faceting.

The only way to do it would be to prepare 'range' fields in your index
at index time, such as:

range-hundreds: 100-200
range-hundreds: 201-300
range-hundreds 301-400

Then pivot facet on your new range-hundreds field and your category
field.

Hmm, now you've got me thinking...

Upayavira, who is mentally rewriting one of his apps now

On Tue, Jan 22, 2013, at 12:36 PM, Bram Van Dam wrote:
> Hi folks,
> 
> Is it possible to pivot by ranges in a single query?
> 
> Something like this:
> 
> select?q=*:*&facet=true&facet.pivot=product_category,price[0-1000, gap
> 100]
> 
> I would expect output like this:
> category A: range 0-100: 3, range 100-200: 2, range 200-300: 5
> category B: range 0-100: 11, range 100-200: 9, range 200-300: 3
> 
> etc
> 
> If I specify a range specification in the normal way 
> (facet.range=price&facet.range.start=0&facet.range.end=1000&facet.range.gap=+100),
>  
> then nothing happens. That's to say, I get a facet_ranges section in my 
> response, with all ranges and counts, and a pivot section which contains 
> individual price amounts as opposed to ranges.
> 
> I'm aware that this question has been asked before 
> (http://lucene.472066.n3.nabble.com/facet-pivot-and-range-td3680508.html), 
> but I can't seem to find an answer anywhere.
> 
> Thanks a bunch,
> 
>   - Bram

Reply via email to