lib/aws_cloud_search/document_batch.rb
# Adds a delete document operation to the batch. Removes lang and fields from the object as they are not
# required for delete operations.
# @param [Document] doc The document to delete
# @raise [ArgumentError] If parameter is not an AWSCloudSearch::Document
# TODO: refactor to only use the required fields, hide the document construction from the user
Adds a delete document operation to the batch. Removes lang and fields from the object as they are not
required for delete operations.
Adds a delete document operation to the batch . Removes lang and fields from the object as they are not required for delete operations .
def delete_document(doc)
      raise ArgumentError.new("Invalid Type") unless doc.is_a? Document
      doc.type = 'delete'
      doc.lang = nil
      doc.clear_fields
      doc_bytesize = doc.to_json.bytesize
      raise Exception.new("Max batch size exceeded, document delete was not added to batch.") if (doc_bytesize + @bytesize) > @max_bytesize
      @bytesize += doc_bytesize
      @batch_delete << doc
    end
def delete_document ( doc ) raise ArgumentError . new ( "Invalid Type" ) unless doc . is_a? Document doc . type = 'delete' doc . lang = nil doc . clear_fields doc_bytesize = doc . to_json . bytesize raise Exception . new ( "Max batch size exceeded, document delete was not added to batch." ) if ( doc_bytesize + @bytesize ) > @max_bytesize @bytesize += doc_bytesize @batch_delete << doc end
Adds a delete document operation to the batch.
Adds a delete document operation to the batch .
[ArgumentError] If parameter is not an AWSCloudSearch::Document TODO: refactor to only use the required fields, hide the document construction from the user
[ ArgumentError ] If parameter is not an AWSCloudSearch :: Document TODO : refactor to only use the required fields hide the document construction from the user
doc
<not_specific>
<not_specific>
doc The document to delete
doc The document to delete