Skip to content

Commit

Permalink
Set stem_keywords to true if stemmer_class given
Browse files Browse the repository at this point in the history
  • Loading branch information
semaperepelitsa committed Feb 16, 2012
1 parent cf5daec commit 528b54f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/mongoid_search/mongoid_search.rb
Expand Up @@ -23,8 +23,9 @@ def search_in(*args)
self.match = [:any, :all].include?(options[:match]) ? options[:match] : :any
self.allow_empty_search = [true, false].include?(options[:allow_empty_search]) ? options[:allow_empty_search] : false
self.relevant_search = [true, false].include?(options[:relevant_search]) ? options[:relevant_search] : false
self.stem_keywords = [true, false].include?(options[:stem_keywords]) ? options[:stem_keywords] : false
self.stemmer_class = options.fetch(:stemmer_class, MongoidSearch::FastStemmer)
self.stemmer_class = options[:stemmer_class]
self.stem_keywords = !!stemmer_class || options[:stem_keywords]
self.stemmer_class ||= MongoidSearch::FastStemmer
self.ignore_list = YAML.load(File.open(options[:ignore_list]))["ignorelist"] if options[:ignore_list].present?
self.search_fields = (self.search_fields || []).concat args

Expand Down

0 comments on commit 528b54f

Please sign in to comment.