Sha256: 3e93a52d6ddbd29b5cef49f9a81f3afcd3e7b9000aca4911b4fd4c4c820faabc

Contents?: true

Size: 831 Bytes

Versions: 8

Compression:

Stored size: 831 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, options[:commit], 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

8 entries across 8 versions & 1 rubygems

Version Path
xapian_db-1.3.15 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.14 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.13 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.12 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.11 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.10 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.9 lib/xapian_db/index_writers/beanstalk_worker.rb
xapian_db-1.3.8 lib/xapian_db/index_writers/beanstalk_worker.rb