One way of getting the min/max values is to fire off two additional queries, 
using the current query and filter params, a field list ("fl") containing just 
the field you want to find min/max for, asking for a single hit (rows=1), and 
sorting by that field - asc in one query, desc in the other. This should be 
relatively cheap, assuming that you can re-use cached information from the main 
query.

Assuming that your price field is named "price", modifying your main query by 
appending

fl=price&rows=1&sort=price+asc

fl=price&rows=1&sort=price+desc

should give you the min and max values you require.

On 06 Nov 2013, at 12:42 , PeterKerk <vettepa...@hotmail.com> wrote:

> Thanks!
> I know how to fire a range query. However, what I want is to provide the
> visitor with a range filter. In this range filter the minimum and maximum
> value are already set to the lowest and highest price of the current
> resultset.
> 
> e.g.
> I sell cars. My cheapest car is 1,000 and the most expensive is 100,000
> A user comes on the site and all cars are shown, so the price range filter
> he sees is set to start at 1,000 and end at 100,000
> 
> Then the user filters on brand Audi.
> 
> The cheapest Audi is 40,000 and the most expensive 80,000
> In this case I the price range filter changes, and holds a minimum value of
> 40,000 and a max of 80,000. This will a) give the user an indication of all
> Audi prices and b) prevent him from selecting a price for which there is no
> car available.
> 
> I believe this is different then what you are suggesting right?
> 
> 
> 
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/get-min-max-prices-as-facets-tp4099501p4099565.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to