Class: XapianDb::IndexWriters::SidekiqWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/xapian_db/index_writers/sidekiq_writer.rb

Class Method Summary collapse

Class Method Details

.delete_doc_with(xapian_id, commit = true) ⇒ Object

Remove an object from the index

Parameters:

  • xapian_id (String)

    The document id



25
26
27
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 25

def delete_doc_with(xapian_id, commit=true)
  Sidekiq::Client.enqueue worker_class, :delete_doc, :xapian_id => xapian_id
end

.index(obj, commit = true, changed_attrs: []) ⇒ Object

Update an object in the index

Parameters:

  • obj (Object)

    An instance of a class with a blueprint configuration



19
20
21
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 19

def index(obj, commit=true, changed_attrs: [])
  Sidekiq::Client.enqueue worker_class, :index, :class => obj.class.name, :id => obj.id, :changed_attrs => changed_attrs
end

.reindex_class(klass, options = {}) ⇒ Object

Reindex all objects of a given class

Parameters:

  • klass (Class)

    The class to reindex



31
32
33
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 31

def reindex_class(klass, options = {})
  Sidekiq::Client.enqueue worker_class, :reindex_class, :class => klass.name
end

.worker_classObject



35
36
37
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 35

def worker_class
  SidekiqWorker
end