Class: ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob
- Inherits:
-
Object
- Object
- ThinkingSphinx::Deltas::DelayedDelta::FlagAsDeletedJob
- Defined in:
- lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb
Overview
A simple job for flagging a specified Sphinx document in a given index as ‘deleted’.
Instance Method Summary collapse
- #display_name ⇒ Object
-
#initialize(index, document_id) ⇒ FlagAsDeletedJob
constructor
Initialises the object with an index name and document id.
-
#perform ⇒ Object
Updates the sphinx_deleted attribute for the given document, setting the value to 1 (true).
Constructor Details
#initialize(index, document_id) ⇒ FlagAsDeletedJob
Initialises the object with an index name and document id. Please note that the document id is Sphinx’s unique identifier, and will almost certainly not be the model instance’s primary key value.
12 13 14 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb', line 12 def initialize(index, document_id) @index, @document_id = index, document_id end |
Instance Method Details
#display_name ⇒ Object
16 17 18 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb', line 16 def display_name "Thinking Sphinx: Mark #{@document_id} in #{@index} as deleted" end |
#perform ⇒ Object
Updates the sphinx_deleted attribute for the given document, setting the value to 1 (true). This is not a special attribute in Sphinx, but is used by Thinking Sphinx to ignore deleted values between full re-indexing. It’s particularly useful in this situation to avoid old values in the core index and just use the new values in the delta index as a reference point.
26 27 28 |
# File 'lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb', line 26 def perform ThinkingSphinx::Deltas::DeleteJob.new(@index, @document_id).perform end |