You're not wrong (although, should be an option on Riddle on the 0.9.9  
branch) - however, SetSelect is not for attribute definition, but for  
what (possibly computed) attributes get returned on search calls.  
Also, I'm not sure if AVG gets calculated across a single MVA set, so  
it might not do what you're requesting anyway.

-- 
Pat

On 21/08/2009, at 10:18 AM, zaadjis wrote:

>
> Actually, i think sphinx and the official Ruby API supports aggregates
> (AVG, MIN, MAX, COUNT) since 0.9.9-rc2. But I don't think riddle/
> thinking-sphinx does :(  Am i wrong?
>
> http://sphinxsearch.com/docs/current.html#api-func-setselect
>
> On Aug 20, 7:51 pm, Pat Allan <[email protected]> wrote:
>> I've not tried this myself, but you'll need to do something along the
>> lines of:
>>    has "CAST(AVG(item_ratings.rating) as unsigned)", :as
>> => :item_rating,
>>      :facet => true, :type => :integer
>>    has item_ratings(:id), :as => :item_ratings_ids # to ensure join
>> exists
>>
>> --
>> Pat
>>
>> On 20/08/2009, at 4:24 PM, mrmanishs wrote:
>>
>>
>>
>>> I want to get average ratings for an item for facets, how do I do
>>> this?
>>
>>> Example pseudo code:
>>> Currently:
>>>    has item_ratings(:rating), :as => :item_rating, :facet => true
>>
>>> Would llike something like:
>>>    has item_ratings(:rating).average.to_i, :as
>>> => :item_rating, :facet => true
>>
>>> Thanks!
>>
>>> Manish
> >


--~--~---------~--~----~------------~-------~--~----~
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