If you want to index all the colours, then your example should actually work (provided the association names are correct).
If you want the number of doors for all bedrooms, then try the following: # to force the joins has bedrooms.doors(:id), :as => :door_ids # actual door count has 'COUNT(doors.id)', :as => :door_count, :type => :integer -- Pat On 05/09/2009, at 9:03 PM, mrmanishs wrote: > > All, > > How would I index attribute of a a one-to-many-to-many association? > > Example: > > House ==> has many bedrooms > each bedroom has many doors, of a certain color. I don't have > a :through relationship because it's one to many, so house_id is > stored on the bedroom table. > > How would I tell it to index it so that House knows how many colored > doors it has for its bedrooms? I'd like to do something like this > (obviously it doesn't work): > > class House << ActiveRecord::Base > has_many :bedrooms > > define_index do > indexes bedrooms.doors.color, :as => :bedroom_door_color, :facet > => true > end > > end > > Thanks. > > Manish > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
