Class: Solr::CursorStream::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Solr::CursorStream::Response
- Defined in:
- lib/solr/cursorstream/response.rb
Overview
Wrapper around a Faraday::Response that provides sugar methods to get solr docs, numFound, and the cursor value
Instance Method Summary collapse
-
#cursor ⇒ String
Value of the cursor as returned from solr.
-
#docs ⇒ Array<Hash>
Array of solr documents returned, as simple hashes.
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
-
#num_found ⇒ Integer
Number of documents found for the solr query.
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 |
# File 'lib/solr/cursorstream/response.rb', line 9 def initialize(faraday_response) super @base_resp = faraday_response @resp = faraday_response.body __setobj__(@resp) end |
Instance Method Details
#cursor ⇒ String
Returns value of the cursor as returned from solr.
27 28 29 |
# File 'lib/solr/cursorstream/response.rb', line 27 def cursor @resp["nextCursorMark"] end |
#docs ⇒ Array<Hash>
Returns Array of solr documents returned, as simple hashes.
17 18 19 |
# File 'lib/solr/cursorstream/response.rb', line 17 def docs @resp["response"]["docs"] end |
#num_found ⇒ Integer
Returns Number of documents found for the solr query.
22 23 24 |
# File 'lib/solr/cursorstream/response.rb', line 22 def num_found @resp["response"]["numFound"] end |