Class: Solr::Request::AddDocument
- Defined in:
- lib/solr/request/add_document.rb
Instance Method Summary collapse
-
#initialize(doc = {}) ⇒ AddDocument
constructor
create the request, optionally passing in a Solr::Document.
-
#to_s ⇒ Object
returns the request as a string suitable for posting.
Methods inherited from Update
Methods inherited from Base
#content_type, #handler, #response_format
Constructor Details
#initialize(doc = {}) ⇒ AddDocument
create the request, optionally passing in a Solr::Document
request = Solr::Request::AddDocument.new doc
as a short cut you can pass in a Hash instead:
request = Solr::Request::AddDocument.new :creator => 'Jorge Luis Borges'
or an array, to add multiple documents at the same time:
request = Solr::Request::AddDocument.new([doc1, doc2, doc3])
32 33 34 35 36 37 38 39 |
# File 'lib/solr/request/add_document.rb', line 32 def initialize(doc={}) @docs = [] if doc.is_a?(Array) doc.each { |d| add_doc(d) } else add_doc(doc) end end |