My bad...I deciphered the part you mentioned "and the join table aliases 
may be something other than positive_votes and negative_votes" by checking 
out the development.sphinx config file. They were labeled as 
positive_votes_people and negative_votes_people. So the define index became 
thus:

has "CAST(COUNT(DISTINCT positive_votes_people.id) - COUNT(DISTINCT 
negative_votes_people.id) as float)", :as => :rating, :type => :float
join positive_votes
join negative_votes

and Voila, it works perfect!

Thanks so much Pat, you are the best!

On Friday, December 7, 2012 11:49:44 PM UTC-5, Mike C. wrote:
>
> You're right! It appears the culprit is "indexes tag_taggings.tag(:name), 
> as: :tags". When I remove this attribute from the index the ratings work 
> perfect. Although I need the tags as part of the search...
>
> I tried adding like you said:
>
> has_many :positive_votes, :class_name => 'Vote', :foreign_key => 
> 'voteable_id', :conditions => {:vote => true}
> has_many :negative_votes, :class_name => 'Vote', :foreign_key => 
> 'voteable_id', :conditions => {:vote => false}
>
> define index
>   has "CAST(COUNT(DISTINCT positive_votes.id) - COUNT(DISTINCT 
> negative_votes.id)) as float", :as => :rating, :type => :float
>   join positive_votes
>   join negative_votes
> end
>
> but I keep getting an issue like:
>
>
> <https://lh6.googleusercontent.com/-wsvBMQCkBh0/UMLFdUVWEII/AAAAAAAAAE4/8_MFgc_Ruso/s1600/ts-error.png>
>
>
>
>
> OR
>
>  
>
>
> <https://lh4.googleusercontent.com/-d0_e-c5zgX4/UMLGuDRdJsI/AAAAAAAAAFA/yZj_1mtEwns/s1600/Screen+Shot+2012-12-07+at+11.48.29+PM.png>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/thinking-sphinx/-/0JjKshHjjoUJ.
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