Class: Solr::Response
- Inherits:
-
Object
- Object
- Solr::Response
- Defined in:
- lib/solr-client.rb
Instance Attribute Summary collapse
-
#docs ⇒ Object
readonly
Returns the value of attribute docs.
-
#num_found ⇒ Object
readonly
Returns the value of attribute num_found.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#qtime ⇒ Object
readonly
Returns the value of attribute qtime.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(body) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(body) ⇒ Response
Returns a new instance of Response.
112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/solr-client.rb', line 112 def initialize(body) data = eval(body) header = data["responseHeader"] @status = header["status"] @qtime = header["QTime"] @params = header["params"] @start = @params["start"].to_i @rows = @params["rows"].to_i response = data["response"] @docs = response["docs"] @start = response["start"] @num_found = response["numFound"] end |
Instance Attribute Details
#docs ⇒ Object (readonly)
Returns the value of attribute docs.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def docs @docs end |
#num_found ⇒ Object (readonly)
Returns the value of attribute num_found.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def num_found @num_found end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def params @params end |
#qtime ⇒ Object (readonly)
Returns the value of attribute qtime.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def qtime @qtime end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def rows @rows end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def start @start end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
110 111 112 |
# File 'lib/solr-client.rb', line 110 def status @status end |
Instance Method Details
#success? ⇒ Boolean
126 127 128 |
# File 'lib/solr-client.rb', line 126 def success? @status == 0 end |