class XapianDb::IndexWriters::SidekiqWorker

Worker to update the Xapian index; the worker will be called by sidekiq and uses the DirectWriter to do the real work @author Michael Stämpfli and John Bradley

Constants

APPROVED_TASKS

Public Class Methods

delete_doc(options) click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
32 def delete_doc(options)
33   options = JSON.parse(options)
34   DirectWriter.delete_doc_with options['xapian_id']
35 end
index(options) click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
25 def index(options)
26   options = JSON.parse(options)
27   klass = constantize options['class']
28   obj   = klass.respond_to?('get') ? klass.get(options['id']) : klass.find(options['id'])
29   DirectWriter.index obj, true, changed_attrs: options[:changed_attrs]
30 end
perform(task, options) click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
21 def perform(task, options)
22   send(task, options) if APPROVED_TASKS.include?(task.to_sym)
23 end
queue() click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
17 def queue
18   XapianDb::Config.sidekiq_queue
19 end
reindex_class(options) click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
37 def reindex_class(options)
38   options = JSON.parse(options)
39   klass = constantize options['class']
40   DirectWriter.reindex_class klass, :verbose => false
41 end
set_max_expansion() click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
43 def set_max_expansion
44   XapianDb::Config.set_max_expansion
45 end
sidekiq_retry() click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
47 def sidekiq_retry
48   XapianDb::Config.sidekiq_retry
49 end

Public Instance Methods

perform(task, options) click to toggle source
   # File lib/xapian_db/index_writers/sidekiq_worker.rb
12 def perform(task, options)
13   self.class.send(task, options) if APPROVED_TASKS.include?(task.to_sym)
14 end