diff --git a/lib/searchkick.rb b/lib/searchkick.rb index afee50b..4f8d1a8 100644 --- a/lib/searchkick.rb +++ b/lib/searchkick.rb @@ -83,13 +83,13 @@ module Searchkick def self.search(term = "*", **options, &block) klass = options[:model] - # TODO add in next major version - # if !klass - # index_name = Array(options[:index_name]) - # if index_name.size == 1 && index_name.first.respond_to?(:searchkick_index) - # klass = index_name.first - # end - # end + # make Searchkick.search(index_name: [Product]) and Product.search equivalent + if !klass + index_name = Array(options[:index_name]) + if index_name.size == 1 && index_name.first.respond_to?(:searchkick_index) + klass = index_name.first + end + end query = Searchkick::Query.new(klass, term, options.except(:model)) block.call(query.body) if block -- libgit2 0.21.0