Commit 642ec5190da4e4c61281112c798efe076035bae8

Authored by Andrew Kane
1 parent 0e98b154

Warn for unsupported keywords - #1391

Showing 2 changed files with 12 additions and 0 deletions   Show diff stats
lib/searchkick/index.rb
@@ -187,11 +187,17 @@ module Searchkick @@ -187,11 +187,17 @@ module Searchkick
187 options.delete(:refresh) 187 options.delete(:refresh)
188 188
189 if method_name 189 if method_name
  190 + # TODO throw ArgumentError
  191 + Searchkick.warn("unsupported keywords: #{options.keys.map(&:inspect).join(", ")}") if options.any?
  192 +
190 # update 193 # update
191 import_scope(relation, method_name: method_name, scope: scope) 194 import_scope(relation, method_name: method_name, scope: scope)
192 self.refresh if refresh 195 self.refresh if refresh
193 true 196 true
194 elsif scoped && !full 197 elsif scoped && !full
  198 + # TODO throw ArgumentError
  199 + Searchkick.warn("unsupported keywords: #{options.keys.map(&:inspect).join(", ")}") if options.any?
  200 +
195 # reindex association 201 # reindex association
196 import_scope(relation, scope: scope) 202 import_scope(relation, scope: scope)
197 self.refresh if refresh 203 self.refresh if refresh
test/reindex_test.rb
@@ -92,4 +92,10 @@ class ReindexTest < Minitest::Test @@ -92,4 +92,10 @@ class ReindexTest < Minitest::Test
92 def test_refresh_full_reindex 92 def test_refresh_full_reindex
93 Product.reindex(refresh: true) 93 Product.reindex(refresh: true)
94 end 94 end
  95 +
  96 + def test_partial_async
  97 + store_names ["Product A"]
  98 + # warn for now
  99 + Product.reindex(:search_name, async: true)
  100 + end
95 end 101 end