Sha256: 6a2ccfc17784c1afae565d6cab72d35d646d60010f9cb784d7d66de1cd7540f7
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
require_relative "test_helper" class PartialReindexTest < Minitest::Test def test_class_method store [{name: "Hi", color: "Blue"}] # normal search assert_search "hi", ["Hi"], fields: [:name], load: false assert_search "blue", ["Hi"], fields: [:color], load: false # update product = Product.first product.name = "Bye" product.color = "Red" Searchkick.callbacks(false) do product.save! end Product.searchkick_index.refresh # index not updated assert_search "hi", ["Hi"], fields: [:name], load: false assert_search "blue", ["Hi"], fields: [:color], load: false # partial reindex Product.partial_reindex(:search_name) # name updated, but not color assert_search "bye", ["Bye"], fields: [:name], load: false assert_search "blue", ["Bye"], fields: [:color], load: false end def test_instance_method store [{name: "Hi", color: "Blue"}] # normal search assert_search "hi", ["Hi"], fields: [:name], load: false assert_search "blue", ["Hi"], fields: [:color], load: false # update product = Product.first product.name = "Bye" product.color = "Red" Searchkick.callbacks(false) do product.save! end Product.searchkick_index.refresh # index not updated assert_search "hi", ["Hi"], fields: [:name], load: false assert_search "blue", ["Hi"], fields: [:color], load: false product.partial_reindex(:search_name) # name updated, but not color assert_search "bye", ["Bye"], fields: [:name], load: false assert_search "blue", ["Bye"], fields: [:color], load: false end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
searchkick-1.5.0 | test/partial_reindex_test.rb |
searchkick-1.4.2 | test/partial_reindex_test.rb |
searchkick-1.4.1 | test/partial_reindex_test.rb |