Class: Solr::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/solr-client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#docsObject (readonly)

Returns the value of attribute docs.



110
111
112
# File 'lib/solr-client.rb', line 110

def docs
  @docs
end

#num_foundObject (readonly)

Returns the value of attribute num_found.



110
111
112
# File 'lib/solr-client.rb', line 110

def num_found
  @num_found
end

#paramsObject (readonly)

Returns the value of attribute params.



110
111
112
# File 'lib/solr-client.rb', line 110

def params
  @params
end

#qtimeObject (readonly)

Returns the value of attribute qtime.



110
111
112
# File 'lib/solr-client.rb', line 110

def qtime
  @qtime
end

#rowsObject (readonly)

Returns the value of attribute rows.



110
111
112
# File 'lib/solr-client.rb', line 110

def rows
  @rows
end

#startObject (readonly)

Returns the value of attribute start.



110
111
112
# File 'lib/solr-client.rb', line 110

def start
  @start
end

#statusObject (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

Returns:

  • (Boolean)


126
127
128
# File 'lib/solr-client.rb', line 126

def success?
  @status == 0
end