Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I temporarily disable delta indexing with Thinking Sphinx?

I am running a big migration and would like to disable delta indexing so it runs much faster.

Is there a way to specify in the beginning of the task to turn delta indexing off?

like image 256
Yoni Baciu Avatar asked Apr 30 '11 13:04

Yoni Baciu


2 Answers

Two options:

Model.suspended_delta do
  # all actions in the block don't fire a delta request
end
# A single delta request gets fired at the end

Or, what may be better in your situation:

ThinkingSphinx.deltas_enabled = false

And set it back to true when you're done.

like image 63
pat Avatar answered Sep 19 '22 12:09

pat


For thinking sphinx v3, you can suspend the deltas this way (the old way is deprecated):

ThinkingSphinx::Deltas.suspend(:index_reference) do
  # Do something
end

So if I have a model called Job with an index named :job, it would look like this:

ThinkingSphinx::Deltas.suspend(:job) do
  # Do Something
end
like image 28
mscriven Avatar answered Sep 19 '22 12:09

mscriven