sunspot_rails not re-indexing model after save

前端 未结 3 1017
-上瘾入骨i
-上瘾入骨i 2020-12-25 14:33

I have a model which deploys a delayed job that updates some of its attributes. The model is declared \"searchable\"...

searchable do
  text :content, :store         


        
3条回答
  •  不思量自难忘°
    2020-12-25 15:01

    The index will only reflect changes after Sunspot.commit is called. This happens automatically when you run rake sunspot:reindex.

    Sunspot's Rails plugin also has a auto_commit_after_request config option which will call Sunspot.commit_if_dirty after every request but this will not be triggered by your background processes.

    Your best bet is to call Sunspot.commit_if_dirty after as the last thing in your delayed job.

提交回复
热议问题