Commit 815dee64fab3f16d0b69e915ea9a207fbd3130ff
1 parent
2cf1c444
Exists in
master
and in
2 other branches
Changed record reindex to return true to match model and relation reindex
Showing
3 changed files
with
8 additions
and
6 deletions
Show diff stats
CHANGELOG.md
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | - Changed async full reindex to fetch ids instead of using ranges for numeric primary keys with Active Record |
9 | 9 | - Changed `searchkick_index_options` to return symbol keys (instead of mix of strings and symbols) |
10 | 10 | - Changed non-anchored regular expressions to match expected results (previously warned) |
11 | +- Changed record reindex to return `true` to match model and relation reindex | |
11 | 12 | - Updated async reindex job to call `search_import` for nested associations |
12 | 13 | - Fixed removing records when `should_index?` is `false` when `reindex` called on relation |
13 | 14 | - Fixed issue with `merge_mappings` for fields that use `searchkick` options | ... | ... |
lib/searchkick/record_indexer.rb
test/reindex_test.rb
... | ... | @@ -5,7 +5,7 @@ class ReindexTest < Minitest::Test |
5 | 5 | store_names ["Product A", "Product B"], reindex: false |
6 | 6 | |
7 | 7 | product = Product.find_by!(name: "Product A") |
8 | - assert_nil product.reindex(refresh: true) | |
8 | + assert_equal true, product.reindex(refresh: true) | |
9 | 9 | assert_search "product", ["Product A"] |
10 | 10 | end |
11 | 11 | |
... | ... | @@ -15,16 +15,15 @@ class ReindexTest < Minitest::Test |
15 | 15 | product = Product.find_by!(name: "Product A") |
16 | 16 | product.destroy |
17 | 17 | Product.search_index.refresh |
18 | - assert_nil product.reindex | |
18 | + assert_equal true, product.reindex | |
19 | 19 | end |
20 | 20 | |
21 | 21 | def test_record_async |
22 | 22 | store_names ["Product A", "Product B"], reindex: false |
23 | 23 | |
24 | 24 | product = Product.find_by!(name: "Product A") |
25 | - # TODO decide on return value | |
26 | 25 | perform_enqueued_jobs do |
27 | - assert_kind_of ActiveJob::Base, product.reindex(mode: :async) | |
26 | + assert_equal true, product.reindex(mode: :async) | |
28 | 27 | end |
29 | 28 | Product.search_index.refresh |
30 | 29 | assert_search "product", ["Product A"] |
... | ... | @@ -37,8 +36,7 @@ class ReindexTest < Minitest::Test |
37 | 36 | store_names ["Product A", "Product B"], reindex: false |
38 | 37 | |
39 | 38 | product = Product.find_by!(name: "Product A") |
40 | - # TODO improve return value | |
41 | - assert_equal 1, product.reindex(mode: :queue) | |
39 | + assert_equal true, product.reindex(mode: :queue) | |
42 | 40 | Product.search_index.refresh |
43 | 41 | assert_search "product", [] |
44 | 42 | ... | ... |