我是否正确重新索引此Sphinx索引?

Eth*_*han 2 ruby sphinx ruby-on-rails thinking-sphinx

根据Thinking Sphinx文档 ......

打开delta索引并不会消除定期运行完整重新索引的需要......

所以我设置了这个cron工作......

50 10 * * * cd /var/www/my_app/current
  && /opt/ruby/bin/rake thinking_sphinx:index RAILS_ENV=production
    >> /var/www/my_app/current/log/reindexing.log 2>&1
Run Code Online (Sandbox Code Playgroud)

这是一种合理的方式吗?我应该做些不同的事吗?

Lev*_*evi 6

那看起来很棒.在缺点方面,它非常昂贵.在生产中,您可以安全地切割图片中的轨道,耙子等,并让狮身人面像直接进行工作.

考虑从cron执行此操作(更正与您的环境匹配的路径):

/usr/local/bin/indexer --config /var/www/my_app/current/config/production.sphinx.conf --all --rotate >> /var/www/my_app/current/log/reindexing.log 2>&1
Run Code Online (Sandbox Code Playgroud)

只需确保您的部署过程构建production.sphinx.conf(我认为您需要rake ts:configure - 但请检查文档.)