You'll have to create a SQL snippet with that logic. Maybe something like: indexes 'IF(addresses.street_name IS NULL, addresses.co, addresses.street_name)', :as => :address
Keep in mind you'll need to refer to the address association in another field or attribute to force the join: has address(:id), :as => :address_id -- Pat On 25/08/2009, at 11:49 AM, rejeep wrote: > > Hi! > > Is there any way to index a column on a condition? I have this index: > define_index do > indexes :name > indexes [ address.street_name, address.co, address.city.name ], :as > => :address > end > But what I really want is to only index address co if there's no > street_name. So in ruby terms: "address.street_name || address.co" > > Thanks! > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
