You'll need to force the join on the association - add this to your define_index block:
join a.c -- Pat On 03/02/2012, at 12:58 AM, mohitnegi wrote: > Hi, > > I have 3 model (A,B and C) and the association is like > > In A > has_one :B, :class_name => ' ', :foreign_key => :a_id > has_one :C, :class_name =>' ', :foreign_key => :id > > In B > belongs_to :A, :class_name => ' ', :foreign_key => :a_id > > In C > belongs_to :A, :foreign_key => 'id' > has_one :C, :class_name=>' ', :through=>:a, :foreign_key=>:id > > > Now i have defined my index in model B.as > > has "COUNT(DISTINCT c.id) > 0", :as => :has_c, :type=> :boolean > > I want that if a set of records in model A has record in model C also then in > my index definition the boolean field has_c should be true else false. > > But as i run > bundle exec rake ts:rebuild it gives following error > > Unknown column 'c.id' in 'field list' > > > -- > 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/-/a9l2O35Y06AJ. > 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. -- 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.
