sunspot/sunspot — pull request #503 by fivedigit (2013-11-10 23:16:39+00:00)
Title: Adds Solr stats support

This pull request adds full support for stats, including faceting on different stats fields. The stats DSL looks like this:
```ruby
search = Sunspot.search(Post) do
stats :average_rating do
facet :blog_id
end
end
```
The field stats and its facets are easily retrieved. If the field references a type, it's automatically retrieved:
```ruby
puts "Maximum average rating: #{search.stats(:average_rating).max}"

search.stats(:average_rating).facet(:blog_id).rows do |row|
puts "Minimum average rating for blog #{row.instance.name}: #{row.min}"
end
```