Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
ThinkingSphinx + Sidekiq delta indexing.
Ruby

This branch is 7 commits ahead of swapnilabnave:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
features
lib
spec
tasks
.gitignore
.rspec
Gemfile
Guardfile
LICENSE
README.markdown
Rakefile
cucumber.yml
ts-sidekiq-delta.gemspec

README.markdown

Delayed Deltas for Thinking Sphinx (with Sidekiq)

This code is HEAVILY borrowed from ts-resque-delta.

Installation

Add ts-sidekiq-delta to your Gemfile file, with the rest of your gem dependencies:

gem 'ts-sidekiq-delta', '0.0.4', github: 'sergio1990/ts-sidekiq-delta'

If you're using Rails 3, the rake tasks will automatically be loaded by Rails.

Add the delta property to each define_index block:

define_index delta: ThinkingSphinx::Deltas::SidekiqDelta do
  # ...
end

If you've never used delta indexes before, you'll want to add the boolean column named :delta to each model's table (note, you must set the :default value to true):

def self.up
  add_column :foos, :delta, :boolean, default: true, null: false
end

Also, I highly recommend adding a MySQL index to the table of any model using delta indexes. The Sphinx indexer uses WHERE table.delta = 1 whenever the delta indexer runs and ... = 0 whenever the normal indexer runs. Having the MySQL index on the delta column will generally be a win:

def self.up
  # ...
  add_index :foos, :delta
end

Usage

Once you've got it all set up, all you need to do is make sure that the Resque worker is running. You can do this by specifying the :ts_delta queue when running Resque:

sidekiq -q ts_delta

Additionally, ts-resque-delta will wrap thinking-sphinx's thinking_sphinx:index and thinking_sphinx:reindex tasks with thinking_sphinx:lock_deltas and thinking_sphinx:unlock_deltas. This will prevent the delta indexer from running at the same time as the main indexer.

Finally, ts-sidekiq-delta also provides a rake task called thinking_sphinx:smart_index (or ts:si for short). This task, instead of locking all the delta indexes at once while the main indexer runs, will lock each delta index independently and sequentially. Thay way, your delta indexer can run while the main indexer is processing large core indexes.

Very little has been changed in this version from the sources below, so very little credit to me.

Author

Contributors (for ts-sidekiq-delta)


Contributors (for ts-resque-delta)

Original Contributors (for ts-delayed-delta)

Copyright

Copyright (c) 2012 Danny Hawkins, and released under an MIT Licence.

Something went wrong with that request. Please try again.