class XapianDb::IndexWriters::TransactionalWriter
Attributes
Public Class Methods
Source
# File lib/xapian_db/index_writers/transactional_writer.rb 16 def initialize 17 @index_requests = [] 18 @delete_requests = [] 19 end
Constructor
Public Instance Methods
Source
# File lib/xapian_db/index_writers/transactional_writer.rb 43 def commit_using(writer) 44 @index_requests.each { |obj| writer.index obj, false } 45 @delete_requests.each { |xapian_id| writer.delete_doc_with xapian_id, false } 46 XapianDb.database.commit 47 end
Commit all pending changes to the database @param [DirectWriter, BeanstalkWriter] writer The writer to use
Source
# File lib/xapian_db/index_writers/transactional_writer.rb 29 def delete_doc_with(xapian_id, commit=false) 30 @delete_requests << xapian_id 31 end
Remove a document from the index @param [String] xapian_id The document id
Source
# File lib/xapian_db/index_writers/transactional_writer.rb 23 def index(obj, commit=false, changed_attrs: []) 24 @index_requests << obj 25 end
Update an object in the index @param [Object] obj An instance of a class with a blueprint configuration
Source
# File lib/xapian_db/index_writers/transactional_writer.rb 37 def reindex_class(klass, options={}) 38 raise "rebuild_xapian_index is not supported in transactions" 39 end
Reindex all objects of a given class @param [Class] klass The class to reindex @param [Hash] options Options for reindexing @option options [Boolean] :verbose (false) Should the reindexing give status informations?