Sha256: d986bdd967051795545676cfcbfc25060f409a27cba08d7db631195fde151db3
Contents?: true
Size: 1.2 KB
Versions: 8
Compression:
Stored size: 1.2 KB
Contents
# -*- coding: utf-8 -*- # This writer uses sidekiq to enqueue index jobs # @author Michael Stämpfli and John Bradley require 'sidekiq' module XapianDb module IndexWriters class SidekiqWriter SidekiqWorker.class_eval do include Sidekiq::Worker end class << self # Update an object in the index # @param [Object] obj An instance of a class with a blueprint configuration def index(obj, commit=true, changed_attrs: []) Sidekiq::Client.enqueue worker_class, :index, :class => obj.class.name, :id => obj.id, :changed_attrs => changed_attrs end # Remove an object from the index # @param [String] xapian_id The document id def delete_doc_with(xapian_id, commit=true) Sidekiq::Client.enqueue worker_class, :delete_doc, :xapian_id => xapian_id end # Reindex all objects of a given class # @param [Class] klass The class to reindex def reindex_class(klass, options = {}) Sidekiq::Client.enqueue worker_class, :reindex_class, :class => klass.name end def worker_class SidekiqWorker end private :worker_class end end end end
Version data entries
8 entries across 8 versions & 1 rubygems