I'm having a problem indexing relations with conditions on the
relation. I'll let the example show what I mean...
class User < ActiveRecord::Base
has_many :friends_out, :class_name => 'UserRelation' :foreign_key =>
'created_by_id',
:conditions => { :state => 'friend' }
has_many :friends_in, :class_name => 'UserRelation' :foreign_key =>
'target_id',
:conditions => { :state => 'friend' }
define_index
# fields.....
has [friends_out(:id), friends_in(:id)], :as => :friend_ids
end
end
The problem is the generated sphinx config has incorrect joins to
accomplish this..,
LEFT OUTER JOIN `user_relations` user_relations_friends_ins_users ON
user_relations_friends_ins_users.target_user_id = users.id AND
`user_relations`.`state` = 'friend'
LEFT OUTER JOIN `user_relations` ON user_relations.created_by_id =
users.id AND `user_relations`.`state` = 'friend'
The 'state' column is ambiguous. Is this a bug? I am doing something
incorrectly?
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---