I run sphinx on my db server, and I have two separate app servers that
both talk to the sphinx instance on the db server. Here's what I use
in my capistrano script:

namespace :sphinx do

  desc "Reindex all"
  task :index, :roles => :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
ts:index"
  end

  desc "Reindex just the past 15 minutes of stuff (based on delta last
modified time)"
  task :delta, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
thinking_sphinx:index:delta"
  end

  desc "Merge deltas into main index. Not used because we just usually
reindex every morning."
  task :merge, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
thinking_sphinx:index:merge"
  end

  desc "Create config. Generally not used since config gets
regenerated on index tasks."
  task :config, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
ts:config"
  end

  desc "start sphinx daemon"
  task :start, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
ts:start"
  end

  desc "stop sphinx daemon"
  task :stop, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake ts:stop"
  end

  desc "restart sphinx daemon"
  task :restart, :roles=> :db do
    run "cd #{current_release} && RAILS_ENV=#{rails_env} rake
ts:restart"
  end
end

If you need delta indexes, I suggest using bassnode's branch:
http://github.com/bassnode/thinking-sphinx/tree/master

And the blog post describing how to use it:
http://blog.edhickey.com/2008/09/15/thinkingsphinx-rails-plugin-fork/

I have a crontab that runs every 15 minutes to re-index, and a daily
crontab that re-indexes the whole db every 24 hours.

Hope that helps.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to