class XapianDb::IndexWriters::ResqueWorker

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

Constants

APPROVED_TASKS

Public Class Methods

delete_doc(options) click to toggle source
   # File lib/xapian_db/index_writers/resque_worker.rb
27 def delete_doc(options)
28   DirectWriter.delete_doc_with options['xapian_id']
29 end
index(options) click to toggle source
   # File lib/xapian_db/index_writers/resque_worker.rb
21 def index(options)
22   klass = constantize options['class']
23   obj   = klass.respond_to?('get') ? klass.get(options['id']) : klass.find(options['id'])
24   DirectWriter.index obj, true, changed_attrs: options[:changed_attrs]
25 end
perform(task, options) click to toggle source
   # File lib/xapian_db/index_writers/resque_worker.rb
17 def perform(task, options)
18   send(task, options) if APPROVED_TASKS.include?(task.to_sym)
19 end
queue() click to toggle source
   # File lib/xapian_db/index_writers/resque_worker.rb
13 def queue
14   XapianDb::Config.resque_queue
15 end
reindex_class(options) click to toggle source
   # File lib/xapian_db/index_writers/resque_worker.rb
31 def reindex_class(options)
32   klass = constantize options['class']
33   DirectWriter.reindex_class klass, :verbose => false
34 end