Ruby on Rails
Monday, February 3, 2014
Thanks,
Prakash.NOn Fri, Jan 31, 2014 at 4:00 PM, <kishore.seemala@amzur.com> wrote:
--I have a 2 entities which have many to many relation say teacher and subject. Each teacher has many subjects. I want to perform search on teacher by sunspot solr for all the teacher who teaches 3 subjects biology, anatomy and botany with specific time.----------
Say model structures and relations as follows
Teacher - name, roll, ph nohas many :subjectssearchable dostring :subjects, multiple => true, stored => true dosubjects.map(&:title)endstring :time, multiple => true, stored => true dosubjects.map(&:time)endendSubject - title, time, teacher_idbelongs_to :teacherHow would I perform solr search query for the teachers who are having all 3 subjects biology, anatomy and botany at time 3:00pm.I am trying with following code which is not taking and condition to retrieve only the teachers teaching all the 3 subjects rather its taking as or condition.Sunspot.search(Teacher) dowith(:subjects, "biology")with(:subjects, "anatomy")with(:subjects, "botany")with(:time, "3:00pm")end.results
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/50ff3bee-770e-485b-a47b-8386a8146aa0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B2e7DG3Gd524hz4Ea_CqEGOpBLUjmiD7d5eE882Gf9xg49dJw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment