pat / ts-delayed-delta

Manage delta indexes via Delayed Job for Thinking Sphinx
http://ts.freelancing-gods.com
MIT License
73 stars 33 forks source link

Gem is not respecting the primary_key setting on indices #51

Closed maxhollmann closed 8 years ago

maxhollmann commented 8 years ago

Don't have time right now to create a proper pull request, but this monkey patch fixes it in my project:

class ThinkingSphinx::Deltas::DelayedDelta
  module SphinxQL
    def delete(index, instance)
      Delayed::Job.enqueue(
        ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob.new(
          index.name,
          index.document_id_for_key(instance.send(index.options[:primary_key] || :id))
        ), self.class.job_options
      )
    end
  end
end
pat commented 8 years ago

Thanks, just made that change in 8866b0a28cdda8fae56c0efcf3b8df0bdf716427.