Commit ec269be04a18ff28c85cd98dfa5d10cb3da5cb53

Authored by Morteza Milani
Committed by GitHub
1 parent 18477e2f

Fix argument error when passing refresh to reindex (#1367)

`reindex_scope` function that is called in the else block of
`reindex` raises an argument error exception when `refresh` option
is passed on. This commit makes sure it is removed from the options.
Showing 2 changed files with 5 additions and 0 deletions   Show diff stats
lib/searchkick/index.rb
... ... @@ -184,6 +184,7 @@ module Searchkick
184 184  
185 185 def reindex(relation, method_name, scoped:, full: false, scope: nil, **options)
186 186 refresh = options.fetch(:refresh, !scoped)
  187 + options.delete(:refresh)
187 188  
188 189 if method_name
189 190 # update
... ...
test/reindex_test.rb
... ... @@ -88,4 +88,8 @@ class ReindexTest < Minitest::Test
88 88 def test_resume
89 89 assert Product.reindex(resume: true)
90 90 end
  91 +
  92 + def test_full_reindex
  93 + Product.reindex(refresh: true)
  94 + end
91 95 end
... ...