Class: WorklingDelta::Indexer

Inherits:
ThinkingSphinx::Deltas::DefaultDelta
  • Object
show all
Defined in:
lib/workling_delta/indexer.rb

Overview

This is the class that that should be wired to your index configuration

Examples:

definition in an index

define_index do |index|
  set_property :delta => WorklingDelta::Indexer
end

Instance Method Summary collapse

Instance Method Details

#do_index(model, instance = nil) ⇒ Boolean

Creates the worker that performs the delta indexing

Parameters:

  • model

    the class of that triggered the delta

  • instance (defaults to: nil)

    the instance that changed (if applicable)

Returns:

  • (Boolean)

    should always return true



12
13
14
15
16
17
# File 'lib/workling_delta/indexer.rb', line 12

def do_index(model, instance = nil)
  doc_id = instance ? instance.sphinx_document_id : nil
  WorklingDelta::Worker.async_index(:index_name => delta_index_name(model), :document_id => doc_id)

  true
end