Class: Groonga::Client::Response::Select

Inherits:
Base
  • Object
show all
Includes:
Enumerable
Defined in:
lib/groonga/client/response/select.rb

Defined Under Namespace

Classes: Drilldown, Record, Slice

Instance Attribute Summary collapse

Attributes inherited from Base

#body, #command, #header, #raw

Instance Method Summary collapse

Methods inherited from Base

#elapsed_time, #error_message, #initialize, parse, #return_code, #start_time, #status_code, #success?

Constructor Details

This class inherits a constructor from Groonga::Client::Response::Base

Instance Attribute Details

#drilldowns::Array<Groonga::Client::Response::Select::Drilldown>, ::Hash<String, Groonga::Client::Response::Select::Drilldown>

If labeled drilldowns are used or command version 3 or later is used, {"label1" => drilldown1, "label2" => drilldown2} is returned since 0.3.1.

Otherwise, [drilldown1, drilldown2] is returned.



193
194
195
# File 'lib/groonga/client/response/select.rb', line 193

def drilldowns
  @drilldowns
end

#n_hitsInteger Also known as: total_count

Returns The number of records that match againt a search condition.

Returns:

  • (Integer)

    The number of records that match againt a search condition.



181
182
183
# File 'lib/groonga/client/response/select.rb', line 181

def n_hits
  @n_hits
end

#recordsObject

Returns the value of attribute records



184
185
186
# File 'lib/groonga/client/response/select.rb', line 184

def records
  @records
end

#slices::Hash<String, Groonga::Client::Response::Select::Slice>

Returns:

Since:

  • 0.3.4



198
199
200
# File 'lib/groonga/client/response/select.rb', line 198

def slices
  @slices
end

Instance Method Details

#body=(body) ⇒ Object



200
201
202
203
# File 'lib/groonga/client/response/select.rb', line 200

def body=(body)
  super(body)
  parse_body(body)
end

#each(&block) ⇒ Object



220
221
222
# File 'lib/groonga/client/response/select.rb', line 220

def each(&block)
  records.each(&block)
end

#limit_valueObject

For Kaminari



206
207
208
# File 'lib/groonga/client/response/select.rb', line 206

def limit_value
  (@command[:limit] || 10).to_i
end

#offset_valueObject

For Kaminari



211
212
213
# File 'lib/groonga/client/response/select.rb', line 211

def offset_value
  (@command[:offset] || 0).to_i
end

#sizeObject

For Kaminari



216
217
218
# File 'lib/groonga/client/response/select.rb', line 216

def size
  records.size
end