Вопрос

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?

Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top