Hi Matt The association is plural, and so that's how it needs to be referenced in your index definition - try this: indexes ingredients.title, :as => :ingredient_titles
And then run rake ts:rebuild and see if the search now works. Cheers -- Pat On 21/03/2012, at 1:56 AM, Matt Wins wrote: > Hi, i'm creating a recipe website. > > I'd like to be able to search for ingredients and return recipes that > contain these ingredients. > > My Models look like this: > > recipe.rb - > > class Recipe < ActiveRecord::Base > has_and_belongs_to_many :ingredients > > define index do > indexes title > indexes ingredient.title, :as => :ingredient_title > end > > end > > ingredient.rb - > > class Ingredient < ActiveRecord::Base > has_and_belongs_to_many :recipes > end > > I also have a join table that references the two. > > > When I search for a recipe title the search returns as expected, > however the search never returns any results if i type in ingredients. > From what i've read on this group and on the TS git hub page, this > *should* be working. > > Can anyone help? or see what im doing wrong? > > Thanks, > > Matt > > > -- > 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.
