lib/mongoid_search/util.rb in mongoid_search-0.2.3 vs lib/mongoid_search/util.rb in mongoid_search-0.2.4

- old
+ new

@@ -1,14 +1,14 @@ module Util def self.keywords(text, stem_keywords, ignore_list) return [] if text.blank? - text = text. + text = text.to_s. mb_chars. normalize(:kd). to_s. gsub(/[._:;'"`,?|+={}()!@#%^&*<>~\$\-\\\/\[\]]/, ' '). # strip punctuation - gsub(/[^[:alpha:]\s]/,''). # strip accents + gsub(/[^[:alnum:]\s]/,''). # strip accents downcase. split(' '). reject { |word| word.size < 2 } text = text.reject { |word| ignore_list.include?(word) } unless ignore_list.blank? text = text.map(&:stem) if stem_keywords