lib/thinking_sphinx/deltas/delete_job.rb in thinking-sphinx-3.3.0 vs lib/thinking_sphinx/deltas/delete_job.rb in thinking-sphinx-3.4.0

- old
+ new

@@ -2,14 +2,24 @@ def initialize(index_name, document_id) @index_name, @document_id = index_name, document_id end def perform - ThinkingSphinx::Connection.take do |connection| - connection.execute Riddle::Query.update( - @index_name, @document_id, :sphinx_deleted => true - ) + return if @document_id.nil? + + ThinkingSphinx::Logger.log :query, statement do + ThinkingSphinx::Connection.take do |connection| + connection.execute statement + end end rescue ThinkingSphinx::ConnectionError => error # This isn't vital, so don't raise the error. + end + + private + + def statement + @statement ||= Riddle::Query.update( + @index_name, @document_id, :sphinx_deleted => true + ) end end