If you're going to search on the Practitioner class, then you'll need the index at that level, I'm pretty sure.
But, if you want to define indexes on the subclasses, then it *should* work if you're searching using ThinkingSphinx.search. Is this how you were testing? -- Pat On 14/04/2010, at 12:23 AM, Al-Faisal El-Dajani wrote: > Hello, > I have the following STI structure: > > class Practitioner < AR::B > end > > class Person < Practitioner > has_one :address > end > > class Entity < Practitioner > has_many :addresses > end > > class Doctor < Person > end > class Dentist < Person > end > > class Hospital < Entity > end > class Clinic < Entity > end > > As you can see, I have a 3 level STI model. In my db, all records are > instances of the last level, so the type field contains 'doctor', > 'hospital', and the like. Person, Entity, or Practitioner do NOT > appear in the type field. > > My problem is that I am trying to index the address with my records. A > person has one address only, while an entity can have many addresses. > I tried defining my indices at the Person and Entity level, however > whenever I run the index rake task, I keep getting 0 documents > collected. If I move the define_index block to the super class > Practitioner, or to any of the children classes, it works as it > should. > > I can't define the address association on the Practitioner level, > because the association is not defined there. And having to repeat it > for all children classes just screams wrong. > > Any ideas? > > -- > 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. > -- 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.
