Thuva,
Would users then be searching for values matching a given float (as a
string, e.g., "3.9")?  I'm thinking that the precision of the decimal
portion of an average is likely to not match any string someone might
enter, except in degenerate cases (e.g, "0.0"), which makes me wonder
how this might be useful.
Best,
Rick

On Fri, May 15, 2009 at 2:15 PM, Thuva Tharma <[email protected]> wrote:
>
> I have a Business model that has many ratings (in a separate table).
> The average rating for a business is calculated as shown below:
>
> class Business < ActiveRecord::Base
>  has_many :ratings
>
>  def average_rating
>    ratings.average(:value) # value is a field in Rating model
>  end
> end
>
> I would like to index the average rating for businesses via sphinx. I
> tried the following and got an error:
>
> has "AVG(ratings.value)", :as => :rating, :type => :float
>
> Can someone please let me know how to approach this problem?
>
> Thank you in advance.
>
> -- Thuva Tharma
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to