开发者

Am I reindexing this Sphinx index correctly?

According to the Thinking Sphinx docs...

Turning on delta indexing does not remove the need for regularly running a full re-index ...

So I set up this cron job...

开发者_开发问答
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

Is that a reasonable way to do it? Should I be doing something different?


That looks great. On the downside, it's pretty expensive. In production, you can safely cut rails, rake, etc. out of the picture, and have sphinx do the work directly.

Consider doing this (correct the paths to match your environment) from 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

Just make sure your deploy process builds production.sphinx.conf (I think you want rake ts:configure -- check the docs though.)


This is exactly how I ended up reindexing sphinx.

So in answer to your question, yes I think its reasonable, no, I don't think you need to be doing something different. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜