0
votes

rails sunspot solr not working with has_and_belongs_to_many

events -- has_and_belongs_to_many --tags

searchable do text :title, :boost => 5 text :description text :tag_names do tags.map(&:name) end end

In the above example its working with title and description only. not with tag_names.

1

1 Answers

0
votes

well, i am assuming here that the tag_names is an array.. if that is the case, pls give it like this...

searchable do
  text :title, boost: 5 
  text :description
  text :tag_names, multiple: true do 
    tags.map(&:name)
  end 
end

(Try using the new hash notation... give boost: 5 instead of :boost => 5.. This is just a suggestion.. your code will work irrespective of the mechanism that u follow..)