Class: XapianDb::IndexWriters::BeanstalkWorker

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/xapian_db/index_writers/beanstalk_worker.rb

Overview

Worker to update the Xapian index; the worker is used in the beanstalk worker script and uses the DirectWriter to do the real work

Author:

  • Gernot Kogler

Instance Method Summary collapse

Methods included from Utilities

#assert_valid_keys, #camelize, #constantize

Instance Method Details

#delete_doc_task(options) ⇒ Object


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

def delete_doc_task(options)
  DirectWriter.delete_doc_with options[:xapian_id]
end

#index_task(options) ⇒ Object


13
14
15
16
17
# File 'lib/xapian_db/index_writers/beanstalk_worker.rb', line 13

def index_task(options)
  klass = constantize options[:class]
  obj   = klass.respond_to?(:get) ? klass.get(options[:id]) : klass.find(options[:id])
  DirectWriter.index obj, true, changed_attrs: options[:changed_attrs]
end

#reindex_class_task(options) ⇒ Object


23
24
25
26
# File 'lib/xapian_db/index_writers/beanstalk_worker.rb', line 23

def reindex_class_task(options)
  klass = constantize options[:class]
  DirectWriter.reindex_class klass, :verbose => false
end