当我像这样在AR模型中包含searchkick时:
class Dog < ActiveRecord::Base
searchkick # callbacks: :async
end
创建新的Dog模型时,索引是否自动同步,还是必须实现这是
after_commit
回调?我发现文档在这一点上有些模棱两可,而且我无法在测试中验证此行为。
最佳答案
他们应该自动重新索引。除非您有阻止它们的东西。
By default, all records are indexed. To control which records are indexed, use the should_index? method together with the search_import scope.
https://github.com/ankane/searchkick#indexing
关于ruby-on-rails - 创建模型后,searchkick是否会自动更新索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37262367/