Sha256: db982815bc4c95f7bae20beb95fe8d7623233e7408f624c541fd3c26cc9f447f

Contents?: true

Size: 819 Bytes

Versions: 5

Compression:

Stored size: 819 Bytes

Contents

# encoding: utf-8

module XapianDb
  module IndexWriters

    # 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
    class BeanstalkWorker

      include XapianDb::Utilities

      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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xapian_db-1.3.7.4 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.7.3 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.7.2 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.7.1 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.7 lib/xapian_db/index_writers/beanstalk_worker.rb