Question

I have a set up like this:

member.rb

class User < ActiveRecord::Base
  acts_as_ordered_taggable
  acts_as_ordered_taggable_on :pursuits

  ....

  searchable do
    text :user_name
    text :first_name
    text :last_name          
    string :pursuit_list, :multiple => true
  end 
end

members_controller.rb

def index
  @search = Member.search do
    fulltext params[:search] 
  end 
  @query = params[:search]
  @members = @search.results
end

I also have sunspot installed and I'm trying to create a search where you can search for a member based on any matching value in a members' pursuit list. Searching is functioning properly for the other fields but I'm not sure how to get searching through the tag list to work properly. Anyone know how to accomplish this with sunspot?

Was it helpful?

Solution

Apparently all I needed to do was change it to text not string.

searchable do
    text :user_name, :first_name, :last_name, :pursuit_list 
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top