Thanks. I will try that. What was is really weird is this: indexes dealership_name, :sortable => true indexes dealership_zip #indexes makes.name#, :as => :makes_name
when i commented out the makes_name I could search for zip codes just fine after reindexing. Then I did this: indexes dealership_name, :sortable => true #indexes dealership_zip indexes makes.name#, :as => :makes_name After doing this I was able to search for makes_name just fine. But, upon doing this: indexes dealership_name, :sortable => true indexes dealership_zip indexes makes.name#, :as => :makes_name made it so I couldn't search for either. This was leaving my search like the original not your suggestion. I found this very odd. Could this be some kind of bug? Thanks. Erik On Jan 12, 11:22 pm, Pat Allan <[email protected]> wrote: > Hi Erik > > If you want to limit certain terms to specific fields, you can do it > as follows: > > DealerAccount.search :conditions => {:makes_name => "*#{value}*"}, > :order => :dealership_name, > :sort_mode => :desc > > Your define_index block seems to be correct - as long as you use the > association names, Thinking Sphinx should understand what you mean. > > Cheers > > -- > Pat > > On 13/01/2009, at 1:08 PM, elanderholm wrote: > > > > > I'm new to thinking_sphinx and am loving it, but am confused on when > > to use indexes, attributes, and how to access them. > > > I have a makes table and an accounts table. Each has a > > has_and_belongs_to_many relationship with each other. > > > I am using an accounts_makes table to join the two tables. What i > > want to to is search the accounts by name and the makes.name field > > also. > > > I have indexes for the accounts table that look like this: > > define_index do > > indexes dealership_name, :sortable => true > > indexes dealership_zip > > indexes makes.name, :as => :makes_name > > set_property :enable_star => true > > set_property :min_infix_len => 3 > > > end > > > I can search my accounts by by dealership_name and zip code just fine > > by doing something like this: > > @dealers = DealerAccount.search "*#{value}*", :order > > => :dealership_name, :sort_mode => :desc > > > How can also search by the makes_name that each dealership account may > > have through the join table? makes table has name as column that is > > something like 'honda'. > > > Each account may have up to 5 or more makes joined by the > > accounts_makes table. > > > This is probably pretty basic, but I'm having some problems. Any help > > would be great. > > > Thanks. > > Erik --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
