diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b7103..8ea1949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Changed async full reindex to fetch ids instead of using ranges for numeric primary keys with Active Record - Changed `searchkick_index_options` to return symbol keys (instead of mix of strings and symbols) - Changed non-anchored regular expressions to match expected results (previously warned) +- Changed record reindex to return `true` to match model and relation reindex - Updated async reindex job to call `search_import` for nested associations - Fixed removing records when `should_index?` is `false` when `reindex` called on relation - Fixed issue with `merge_mappings` for fields that use `searchkick` options diff --git a/lib/searchkick/record_indexer.rb b/lib/searchkick/record_indexer.rb index c603791..6162060 100644 --- a/lib/searchkick/record_indexer.rb +++ b/lib/searchkick/record_indexer.rb @@ -55,6 +55,9 @@ module Searchkick else raise ArgumentError, "Invalid value for mode" end + + # return true like model and relation reindex for now + true end def reindex_items(klass, items, method_name:, single: false) diff --git a/test/reindex_test.rb b/test/reindex_test.rb index f4b0159..4d113d1 100644 --- a/test/reindex_test.rb +++ b/test/reindex_test.rb @@ -5,7 +5,7 @@ class ReindexTest < Minitest::Test store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") - assert_nil product.reindex(refresh: true) + assert_equal true, product.reindex(refresh: true) assert_search "product", ["Product A"] end @@ -15,16 +15,15 @@ class ReindexTest < Minitest::Test product = Product.find_by!(name: "Product A") product.destroy Product.search_index.refresh - assert_nil product.reindex + assert_equal true, product.reindex end def test_record_async store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") - # TODO decide on return value perform_enqueued_jobs do - assert_kind_of ActiveJob::Base, product.reindex(mode: :async) + assert_equal true, product.reindex(mode: :async) end Product.search_index.refresh assert_search "product", ["Product A"] @@ -37,8 +36,7 @@ class ReindexTest < Minitest::Test store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") - # TODO improve return value - assert_equal 1, product.reindex(mode: :queue) + assert_equal true, product.reindex(mode: :queue) Product.search_index.refresh assert_search "product", [] -- libgit2 0.21.0