sunspot_rails not re-indexing model after save

前端 未结 3 999
-上瘾入骨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:22

    As mentioned by Jason, you can call Sunspot.commit_if_dirty to issue a commit from your client.

    From the server configuration side, another approach would be to set the autoCommit property in your solrconfig.xml to automatically issue commits when there have been changes made to your index. A maxTime of 60000 ms (one minute) should suffice for most sites.

    Using autoCommit is probably the wiser choice in production applications, where a high volume of commits can easily impact your Solr server's performance. In fact, it's a good practice with Sunspot to disable its auto_commit_after_request option when your site starts getting a decent amount of updates.

    Lastly, autoCommit has the advantage of being able to set it and forget it.

    At Websolr, our default is to ignore client-issued commits in favor of autoCommit.

提交回复
热议问题