Thanks for your reply. *Complaint Index File*
ThinkingSphinx::Index.define :complaint, :with => :real_time do indexes user_id indexes nursing_triage_id indexes status indexes complaint_priority indexes user.first_name, :as=>:user_first_name indexes user.last_name, :as=>:user_last_name indexes nursing_triage.first_name, :as=>:nursing_triage_first_name indexes nursing_triage.last_name, :as=>:nursing_triage_last_name has user.id,:as=>:complainer_user_id,:type => :integer has nursing_triage.id,:as=>:complainer_nursing_triage_id,:type => :integer has complaint_replies.staff.id, :as=>:staff_id,:type => :integer has complaint_replies_id,:type => :integer,:multi=>true has staff_ids,:type => :integer,:multi=>true end In *Complaint.rb* I have created below method: def staff_ids complaint_replies.collect(&:staff).collect(&:id) end On Tue, Sep 15, 2015 at 11:36 AM, Pat Allan <[email protected]> wrote: > Hi Chaitali > > Can you share your index definition please? It sounds like something there > isn’t quite correct. And if it’s a real-time index, any methods in > Complaint used by the index definition would be great too. > > Thanks > > — > Pat > > On 11 Sep 2015, at 5:12 am, Chaitali Khangar <[email protected]> > wrote: > > Hi, > > I have tried *Has Many Through Relationship* by real time but its > returning me single result. Can you please help me? > > *Complaint* > has_many :complaint_replies > has_many :staffs, :through=> :complaint_replies > > *Staff* > has_many :complaint_replies > has_many :complaints, :through=> :complaint_replies > > *Complaint Reply* > belongs_to :complaint > belongs_to :staff > > *Thinking Sphinx Query* > > Complaint.search(:with=>{:staff_ids=>Staff.first.id}) > > It's returning *single* result. > > *Expected Output* > > Staff.first.complaints > > Its returning *more than one result* result. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
