def post_to_solr(document, &logger_block)
log.debug("POSTing document to SOLR:\n#{document}")
http_req = EventMachine::HttpRequest.new(solr_url).post(:body => document, :timeout => 1200, :head => CONTENT_TYPE_XML)
http_request_started
http_req.callback do
completed
if http_req.response_header.status == 200
log.info(&logger_block)
else
log.error { "Failed to post to solr: #{indexed_object}" }
end
end
http_req.errback do
completed
log.error { "Failed to post to solr (connection error): #{indexed_object}" }
end
end