lib/activesearch/mongoid.rb in activesearch-0.0.2 vs lib/activesearch/mongoid.rb in activesearch-0.0.3
- old
+ new
@@ -2,10 +2,10 @@
module ActiveSearch
# TODO: Wrap this so all engines behave consistently
def self.search(text)
- Mongoid::Model.all_in(keywords: text.split)
+ Mongoid::Model.where(:keywords.in => text.split + text.split.map { |word| "#{I18n.locale}:#{word}"})
end
module Mongoid
def self.included(base)
base.extend ClassMethods
\ No newline at end of file