module MongoSearch::Searchable::ClassMethods

Public Instance Methods

search_in(*args) click to toggle source
# File lib/mongo_search.rb, line 37
def search_in(*args)
  warn('[DEPRECATION `search_in` is deprecated. Please use `text_search_in` instead.')
  text_search_in(args)
end
text_search_in(*args) click to toggle source
# File lib/mongo_search.rb, line 23
def text_search_in(*args)
  options = args.pop if args.last.has_key?(:match)
  self.match = options[:match]
rescue NoMethodError
ensure
  self.match ||= :all
  self.search_fields = args

  field :_keywords, type: Array
  index({ _keywords: 1 }, { background: true })

  before_save :set_keywords
end