Showing a price range selector for visitor to narrow down search is a common use case for eCommerce sites. Usually developers try to use facets for this purpose which is not a correct way to do it. Facts for price should only be used if we need to break prices in to multiple ranges for selection like 1 to 100, 101 to 500 and 501 to more. For getting just the minimum and maximum price one must use the “stats” feature which is enabled by default in Solr. This can be achieved by providing additional parameters “stats=true&stats.field=price ” in request. Here the “price” is the numeric field in the index, you can change it as per your index/core. So the response from sample request like localhost:8983/solr/products/select?q=*:*&stats=true&stats.field=price&indent=true&wt=json response will include information for stats as
"stats":{ "stats_fields":{ "price":{ "min":2.490000009536743, "max":21528.0, "count":18818, "missing":0, "sum":7420415.467022657, "sumOfSquares":9.140018409573242E9, "mean":394.3254047732308, "stddev":574.657444072605}}}
Here you can see the “min” and “max” values along other stats like “sum”, “mean” etc. Full documentation for this feature can be found here.