Class: XapianDb::IndexWriters::BeanstalkWriter
- Inherits:
-
Object
- Object
- XapianDb::IndexWriters::BeanstalkWriter
- Defined in:
- lib/xapian_db/index_writers/beanstalk_writer.rb
Class Method Summary collapse
- .beanstalk ⇒ Object
-
.delete_doc_with(xapian_id, commit = true) ⇒ Object
Remove an object from the index.
-
.index(obj, commit = true, changed_attrs: []) ⇒ Object
Update an object in the index.
-
.reindex_class(klass, options = {}) ⇒ Object
Reindex all objects of a given class.
Class Method Details
.beanstalk ⇒ Object
37 38 39 |
# File 'lib/xapian_db/index_writers/beanstalk_writer.rb', line 37 def beanstalk @beanstalk ||= Beanstalk::Pool.new([XapianDb::Config.beanstalk_daemon_url]) end |
.delete_doc_with(xapian_id, commit = true) ⇒ Object
Remove an object from the index
27 28 29 |
# File 'lib/xapian_db/index_writers/beanstalk_writer.rb', line 27 def delete_doc_with(xapian_id, commit=true) beanstalk.put( { :task => "delete_doc_task", :xapian_id => xapian_id }.to_json ) end |
.index(obj, commit = true, changed_attrs: []) ⇒ Object
Update an object in the index
21 22 23 |
# File 'lib/xapian_db/index_writers/beanstalk_writer.rb', line 21 def index(obj, commit=true, changed_attrs: []) beanstalk.put( { :task => "index_task", :class => obj.class.name, :id => obj.id, :changed_attrs => changed_attrs }.to_json ) end |
.reindex_class(klass, options = {}) ⇒ Object
Reindex all objects of a given class
33 34 35 |
# File 'lib/xapian_db/index_writers/beanstalk_writer.rb', line 33 def reindex_class(klass, ={}) beanstalk.put( { :task => "reindex_class_task", :class => klass.name }.to_json ) end |