Method: RSolr::Client#send_and_receive

Defined in:
lib/rsolr/client.rb

#send_and_receive(path, opts) ⇒ Object

send_and_receive is the main request method responsible for sending requests to the connection object.

“path” : A string value that usually represents a solr request handler “opts” : A hash, which can contain the following keys:

:method : required - the http method (:get, :post or :head)
:params : optional - the query string params in hash form
:data : optional - post data -- if a hash is given, it's sent as "application/x-www-form-urlencoded; charset=UTF-8"
:headers : optional - hash of request headers

All other options are passed right along to the connection’s send_and_receive method (:get, :post, or :head)

send_and_receive returns either a string or hash on a successful ruby request. When the :params => :ruby, the response will be a hash, else a string.

creates a request context hash, sends it to the connection’s execute method which returns a simple hash, then passes the request/response into adapt_response.



201
202
203
204
# File 'lib/rsolr/client.rb', line 201

def send_and_receive path, opts
  request_context = build_request path, opts
  execute request_context
end