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. :)
精彩评论