Class: XapianDb::IndexWriters::SidekiqWriter
- Inherits:
-
Object
- Object
- XapianDb::IndexWriters::SidekiqWriter
- Defined in:
- lib/xapian_db/index_writers/sidekiq_writer.rb
Class Method Summary collapse
-
.delete_doc_with(xapian_id, _commit = true) ⇒ Object
Remove an object from the index.
-
.index(obj, _commit = true, changed_attrs: []) ⇒ Object
Update an object in the index.
- .queue ⇒ Object
-
.reindex_class(klass, _options = {}) ⇒ Object
Reindex all objects of a given class.
- .set_max_expansion ⇒ Object
- .sidekiq_retry ⇒ Object
- .worker_class ⇒ Object
Class Method Details
.delete_doc_with(xapian_id, _commit = true) ⇒ Object
Remove an object from the index
33 34 35 36 37 38 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 33 def delete_doc_with(xapian_id, _commit= true) Sidekiq::Client.push('queue' => queue, 'class' => worker_class, 'args' => ['delete_doc', { xapian_id: xapian_id }.to_json], 'retry' => sidekiq_retry) end |
.index(obj, _commit = true, changed_attrs: []) ⇒ Object
Update an object in the index
24 25 26 27 28 29 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 24 def index(obj, _commit= true, changed_attrs: []) Sidekiq::Client.push('queue' => queue, 'class' => worker_class, 'args' => ['index', { class: obj.class.name, id: obj.id, changed_attrs: changed_attrs }.to_json], 'retry' => sidekiq_retry) end |
.queue ⇒ Object
18 19 20 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 18 def queue XapianDb::Config.sidekiq_queue end |
.reindex_class(klass, _options = {}) ⇒ Object
Reindex all objects of a given class
42 43 44 45 46 47 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 42 def reindex_class(klass, = {}) Sidekiq::Client.push('queue' => queue, 'class' => worker_class, 'args' => ['reindex_class', { class: klass.name }.to_json], 'retry' => sidekiq_retry) end |
.set_max_expansion ⇒ Object
49 50 51 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 49 def set_max_expansion XapianDb::Config.set_max_expansion end |
.sidekiq_retry ⇒ Object
53 54 55 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 53 def sidekiq_retry XapianDb::Config.sidekiq_retry end |
.worker_class ⇒ Object
57 58 59 |
# File 'lib/xapian_db/index_writers/sidekiq_writer.rb', line 57 def worker_class SidekiqWorker end |