Class: RSolr::Message::Adapter::Libxml
- Inherits:
-
Object
- Object
- RSolr::Message::Adapter::Libxml
- Defined in:
- lib/rsolr/message/adapter/libxml.rb
Instance Method Summary collapse
- #add(documents, attributes = {}) ⇒ Object
- #commit(opts = {}) ⇒ Object
- #delete_by_id(ids) ⇒ Object
- #delete_by_query(queries) ⇒ Object
- #optimize(opts) ⇒ Object
- #rollback ⇒ Object
Instance Method Details
#add(documents, attributes = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 5 def add(documents, attributes = {}) add_node = new_node('add', attributes) for document in documents add_node << doc_node = new_node('doc', document.attrs) for field in document.fields doc_node << field_node = new_node('field', field.attrs) field_node << field.value end end add_node.to_s(:indent => false) end |
#commit(opts = {}) ⇒ Object
45 46 47 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 45 def commit(opts = {}) new_node('commit', opts).to_s end |
#delete_by_id(ids) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 17 def delete_by_id(ids) delete = new_node('delete') for id in Array(ids) id_node = new_node('id') id_node << id delete << id_node end delete.to_s(:indent => false) end |
#delete_by_query(queries) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 27 def delete_by_query(queries) delete = new_node('delete') for query in Array(queries) query_node = new_node('query') query_node << query delete << query_node end delete.to_s(:indent => false) end |
#optimize(opts) ⇒ Object
37 38 39 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 37 def optimize(opts) new_node('optimize', opts).to_s end |
#rollback ⇒ Object
41 42 43 |
# File 'lib/rsolr/message/adapter/libxml.rb', line 41 def rollback new_node('rollback').to_s end |