Delayed Deltas for Thinking Sphinx
You’ll need Thinking Sphinx 1.3.0 or later, and Delayed Job as well. The latter is flagged as a dependency.
gem install ts-delayed-delta --source http://gemcutter.org
environment.rb file, with the rest of your gem dependencies:
config.gem 'ts-delayed-delta', :lib => 'thinking_sphinx/deltas/delayed_delta', :version => '>= 1.0.0', :source => 'http://gemcutter.org'
And add the following line to the bottom of your
Rakefile if you’re not using Rails 3 or newer:
If this is your first time running Delayed Job, then you’re going to need the jobs table migration as well:
For the indices you want to use this delta approach, make sure you set that up in their
define_index do # ... set_property :delta => :delayed end
If you’ve never used delta indices before, you’ll want to add the boolean column named delta to each model that is using the approach.
def self.up add_column :articles, :delta, :boolean, :default => true, :null => false end
Once you’ve got it all set up, all you need to do is make sure that the delayed job process is running – either by Delayed Job’s built-in approach, or Thinking Sphinx’s custom rake task:
There’s also a short name for the same task, to save your fingers some effort:
- Ryan Schlesinger (Allowing installs as a plugin)
- Maximilian Schulz (Ensuring compatibility with Bundler)
- Edgars Beigarts (Adding intelligent description for tasks)
- Alexander Simonov (Explicit table definition)
- David Goodlad (Delayed Job/ActiveRecord load order fix)
- Ben Hutton (Delayed Job compatibility update)
- Reinier de Lange (Fix for table name reference)
- Enrico Brunetta (Adding Railtie for Rails 3)
Copyright © 2009-2010 Pat Allan, and released under an MIT Licence.