Yes but its not adding the staff_ids in complaints table. On Wed, Sep 16, 2015 at 1:01 PM, Pat Allan <[email protected]> wrote:
> I’m not sure why it didn’t work the first way… but also, given you’ve got > the association there, Rails should automatically add a `staff_ids` method > for you, so you don’t need to create one yourself. > > On 16 Sep 2015, at 12:28 am, Chaitali Khangar <[email protected]> > wrote: > > Hi Pat, > > I have tried it in other way. > > def staff_ids > staffs.collect(&:id) > end > > And its returning the expected result. > > But is this a correct way? > > On Wed, Sep 16, 2015 at 12:22 PM, Chaitali Khangar < > [email protected]> wrote: > >> Yes, the generated conf file is: >> >> index complaint_core >> { >> type = rt >> path = >> /home/de1/Documents/DblDocuments/thinking_sphinx_latest/dbl_latest_rails_best_practices/dblpc/db/sphinx/development/complaint_core >> docinfo = extern >> min_infix_len = 1 >> enable_star = 2 >> rt_field = sphinx_internal_class_name >> rt_field = user_id >> rt_field = nursing_triage_id >> rt_field = status >> rt_field = complaint_priority >> rt_field = user_first_name >> rt_field = user_last_name >> rt_field = nursing_triage_first_name >> rt_field = nursing_triage_last_name >> rt_attr_uint = sphinx_deleted >> rt_attr_uint = complainer_user_id >> rt_attr_uint = complainer_nursing_triage_id >> rt_attr_uint = staff_id >> rt_attr_bigint = sphinx_internal_id >> rt_attr_string = sphinx_internal_class >> rt_attr_multi = complaint_replies_id >> rt_attr_multi = staff_ids >> } >> >> >> On Wed, Sep 16, 2015 at 12:25 AM, Pat Allan <[email protected]> >> wrote: >> >>> Hmm, looks right to me. Does the generated development.sphinx.conf file >>> have staff_ids as a multi-value attribute? >>> >>> On 14 Sep 2015, at 11:41 pm, Chaitali Khangar < >>> [email protected]> wrote: >>> >>> 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 >>>> <http://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. >>> >>> >>> >>> -- >>> 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. > -- 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.
