LoginSignup
6
6

More than 5 years have passed since last update.

SunspotでReindexしない方法

Posted at

SunspotはModelを変更すると毎回Reindexしますが、検索に利用しないattributeを変更したときにReindexされると、無駄なコストが発生します。
変更を無視して、Reindexしないようにするオプションが用意されています。

ignore.rb
searchable :ignore_attribute_changes_of => [:favorites_count, :updated_at] do
  text :title
  text :description
end

これでfavorites_countupdated_atが変更されてもReindexが行われません。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6