groonga-client 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03b68a1a7f59bc34045692dd2e552ce9f794bba69e7093bc6190e51fb0193be7
4
- data.tar.gz: 14694be087dafa31671b4965b0c8ff04a8dde8c96050c2284215e3d93c5e1c3e
3
+ metadata.gz: e58e455931babab20e77e8944bce91b4fcd7dc6aee073afb016fbb127d341a2d
4
+ data.tar.gz: 3a5ba751046673d6d32ed7d27b15f2b036740c43dd424741b4e56a176efeab9c
5
5
  SHA512:
6
- metadata.gz: c32a87151621709018d2d2e13e71443558852ff2e2834f3241caacb389534179872d47f7dad739c63b131aadd328a738cd6d571b7859bcaf02393cb42779ef94
7
- data.tar.gz: b87752ad00e9c4a7bed662ec5c14f0ad7a3f2a0ec4b5394ad7e02c20bb45329800500f555567a7798c424a186240bb44d8340cb749fa6638fbdfa4f9f2444692
6
+ metadata.gz: 1e41055f62099dc806883965e9636e7d0be252f40600665e0cc4d53476409f34aaf4bc25fd06e41cfbb79b37bf3a3b562db275b7e4394ca45c3db022ecd9e900
7
+ data.tar.gz: '0284a3e869fb7fc1efd8d7048694f043f4d78794c7a8b279a22a5303f7597fa417be7cef9d2bc7391a475aec3b57de8bed7437d20f9663bb29c4d4ea3793cd60'
@@ -1,5 +1,17 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.6.2 - 2019-09-02
4
+
5
+ ### Improvements
6
+
7
+ * `Groonga::Client::Response::LogicalSelect`: Added.
8
+
9
+ * `Groonga::Client::Response::Select#raw_columns`: Added.
10
+
11
+ * `Groonga::Client::Response::Select#raw_records`: Added.
12
+
13
+ * `Groonga::Client::Response::LogicalRangeFilter`: Added.
14
+
3
15
  ## 0.6.1 - 2019-07-27
4
16
 
5
17
  ### Improvements
@@ -1,7 +1,7 @@
1
1
  # -*- mode: ruby -*-
2
2
  #
3
3
  # Copyright (C) 2013 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2014-2016 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2014-2019 Sutou Kouhei <kou@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  end
49
49
 
50
50
  spec.add_runtime_dependency("gqtp", ">= 1.0.4")
51
- spec.add_runtime_dependency("groonga-command", ">= 1.2.8")
51
+ spec.add_runtime_dependency("groonga-command", ">= 1.4.5")
52
52
  spec.add_runtime_dependency("groonga-command-parser", ">= 1.1.0")
53
53
  spec.add_runtime_dependency("hashie")
54
54
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2019 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2013 Haruka Yoshihara <yoshihara@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -30,6 +30,8 @@ require "groonga/client/response/lock-clear"
30
30
  require "groonga/client/response/log-level"
31
31
  require "groonga/client/response/log-put"
32
32
  require "groonga/client/response/log-reopen"
33
+ require "groonga/client/response/logical-range-filter"
34
+ require "groonga/client/response/logical-select"
33
35
  require "groonga/client/response/quit"
34
36
  require "groonga/client/response/register"
35
37
  require "groonga/client/response/schema"
@@ -0,0 +1,85 @@
1
+ # Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Groonga
18
+ class Client
19
+ module Response
20
+ module Drilldownable
21
+ # @return [::Array<Groonga::Client::Response::Select::Drilldown>,
22
+ # ::Hash<String, Groonga::Client::Response::Select::Drilldown>]
23
+ # If labeled drilldowns are used or command version 3 or
24
+ # later is used, `{"label1" => drilldown1, "label2" => drilldown2}`
25
+ # is returned since 0.3.1.
26
+ #
27
+ # Otherwise, `[drilldown1, drilldown2]` is returned.
28
+ attr_accessor :drilldowns
29
+
30
+ private
31
+ def parse_drilldown(label, keys, raw_drilldown)
32
+ if raw_drilldown.is_a?(::Array)
33
+ n_hits = raw_drilldown[0][0]
34
+ raw_columns = raw_drilldown[1]
35
+ raw_records = raw_drilldown[2..-1]
36
+ else
37
+ n_hits = raw_drilldown["n_hits"]
38
+ raw_columns = raw_drilldown["columns"]
39
+ raw_records = raw_drilldown["records"]
40
+ end
41
+ records = parse_records(raw_columns, raw_records)
42
+ Drilldown.new(label,
43
+ keys,
44
+ n_hits,
45
+ records,
46
+ raw_columns,
47
+ raw_records)
48
+ end
49
+
50
+ def parse_drilldowns(keys, raw_drilldowns)
51
+ (raw_drilldowns || []).collect.with_index do |raw_drilldown, i|
52
+ key = keys[i]
53
+ parse_drilldown(key, [key], raw_drilldown)
54
+ end
55
+ end
56
+
57
+ def parse_labeled_drilldowns(labeled_drilldown_requests,
58
+ raw_drilldowns)
59
+ drilldowns = {}
60
+ (raw_drilldowns || {}).each do |label, raw_drilldown|
61
+ labeled_drilldown_request = labeled_drilldown_requests[label]
62
+ drilldowns[label] = parse_drilldown(label,
63
+ labeled_drilldown_request.keys,
64
+ raw_drilldown)
65
+ end
66
+ drilldowns
67
+ end
68
+
69
+ class Drilldown < Struct.new(:label,
70
+ :keys,
71
+ :n_hits,
72
+ :records,
73
+ :raw_columns,
74
+ :raw_records)
75
+ # @deprecated since 0.2.6. Use {#records} instead.
76
+ alias_method :items, :records
77
+
78
+ def key
79
+ keys.join(", ")
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/client/response/base"
18
+ require "groonga/client/response/searchable"
19
+
20
+ module Groonga
21
+ class Client
22
+ module Response
23
+ class LogicalRangeFilter < Base
24
+ Response.register("logical_range_filter", self)
25
+
26
+ include Searchable
27
+
28
+ attr_accessor :records
29
+
30
+ def body=(body)
31
+ super(body)
32
+ parse_body(body)
33
+ end
34
+
35
+ private
36
+ def parse_body(body)
37
+ if body.is_a?(::Array)
38
+ @raw_columns, *@raw_records = body.first
39
+ @raw_records ||= []
40
+ @records = parse_records(raw_columns, raw_records)
41
+ else
42
+ @raw_columns = body["columns"]
43
+ @raw_records = body["records"] || []
44
+ end
45
+ @records = parse_records(@raw_columns, @raw_records)
46
+ body
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/client/response/select"
18
+
19
+ module Groonga
20
+ class Client
21
+ module Response
22
+ class LogicalSelect < Select
23
+ Response.register("logical_select", self)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,97 @@
1
+ # Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Groonga
18
+ class Client
19
+ module Response
20
+ module Searchable
21
+ include Enumerable
22
+
23
+ attr_accessor :records
24
+ attr_accessor :raw_columns
25
+ attr_accessor :raw_records
26
+
27
+ # For Kaminari
28
+ def limit_value
29
+ (@command[:limit] || 10).to_i
30
+ end
31
+
32
+ # For Kaminari
33
+ def offset_value
34
+ (@command[:offset] || 0).to_i
35
+ end
36
+
37
+ # For Kaminari
38
+ def size
39
+ records.size
40
+ end
41
+
42
+ def each(&block)
43
+ records.each(&block)
44
+ end
45
+
46
+ private
47
+ def parse_records(raw_columns, raw_records)
48
+ column_names = {}
49
+ columns = raw_columns.collect do |column|
50
+ if column.is_a?(::Array)
51
+ name, type = column
52
+ else
53
+ name = column["name"]
54
+ type = column["type"]
55
+ end
56
+ base_column_name = name
57
+ suffix = 2
58
+ while column_names.key?(name)
59
+ name = "#{base_column_name}#{suffix}"
60
+ suffix += 1
61
+ end
62
+ column_names[name] = true
63
+ [name, type]
64
+ end
65
+
66
+ (raw_records || []).collect do |raw_record|
67
+ record = Record.new
68
+ columns.each_with_index do |(name, type), i|
69
+ record[name] = convert_value(raw_record[i], type)
70
+ end
71
+ record
72
+ end
73
+ end
74
+
75
+ def convert_value(value, type)
76
+ case value
77
+ when ::Array
78
+ value.collect do |element|
79
+ convert_value(element, type)
80
+ end
81
+ else
82
+ case type
83
+ when "Time"
84
+ Time.at(value)
85
+ else
86
+ value
87
+ end
88
+ end
89
+ end
90
+
91
+ class Record < ::Hash
92
+ include Hashie::Extensions::MethodAccess
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -17,6 +17,8 @@
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
19
  require "groonga/client/response/base"
20
+ require "groonga/client/response/drilldownable"
21
+ require "groonga/client/response/searchable"
20
22
 
21
23
  module Groonga
22
24
  class Client
@@ -174,23 +176,14 @@ module Groonga
174
176
  end
175
177
  end
176
178
 
177
- include Enumerable
179
+ include Drilldownable
180
+ include Searchable
178
181
 
179
182
  # @return [Integer] The number of records that match againt
180
183
  # a search condition.
181
184
  attr_accessor :n_hits
182
185
  # For Kaminari
183
186
  alias_method :total_count, :n_hits
184
- attr_accessor :records
185
-
186
- # @return [::Array<Groonga::Client::Response::Select::Drilldown>,
187
- # ::Hash<String, Groonga::Client::Response::Select::Drilldown>]
188
- # If labeled drilldowns are used or command version 3 or
189
- # later is used, `{"label1" => drilldown1, "label2" => drilldown2}`
190
- # is returned since 0.3.1.
191
- #
192
- # Otherwise, `[drilldown1, drilldown2]` is returned.
193
- attr_accessor :drilldowns
194
187
 
195
188
  # @return [::Hash<String, Groonga::Client::Response::Select::Slice>]
196
189
  #
@@ -202,29 +195,11 @@ module Groonga
202
195
  parse_body(body)
203
196
  end
204
197
 
205
- # For Kaminari
206
- def limit_value
207
- (@command[:limit] || 10).to_i
208
- end
209
-
210
- # For Kaminari
211
- def offset_value
212
- (@command[:offset] || 0).to_i
213
- end
214
-
215
- # For Kaminari
216
- def size
217
- records.size
218
- end
219
-
220
- def each(&block)
221
- records.each(&block)
222
- end
223
-
224
198
  private
225
199
  def parse_body(body)
226
200
  if body.is_a?(::Array)
227
- @n_hits, @records = parse_match_records_v1(body.first)
201
+ @n_hits, @raw_columns, @raw_records, @records =
202
+ parse_record_set_v1(body.first)
228
203
  if @command.slices.empty?
229
204
  raw_slices = nil
230
205
  raw_drilldowns = body[1..-1]
@@ -232,115 +207,73 @@ module Groonga
232
207
  raw_slices, *raw_drilldowns = body[1..-1]
233
208
  end
234
209
  @slices = parse_slices_v1(raw_slices)
235
- @drilldowns = parse_drilldowns_v1(raw_drilldowns)
236
- else
237
- @n_hits, @records = parse_match_records_v3(body)
238
- @drilldowns = parse_drilldowns_v3(body["drilldowns"])
239
- @slices = parse_slices_v3(body["slices"])
240
- end
241
- body
242
- end
243
-
244
- def parse_records(raw_columns, raw_records)
245
- column_names = {}
246
- columns = raw_columns.collect do |column|
247
- if column.is_a?(::Array)
248
- name, type = column
210
+ drilldown_keys = @command.drilldowns
211
+ labeled_drilldowns = @command.labeled_drilldowns
212
+ if drilldown_keys.empty? and !labeled_drilldowns.empty?
213
+ @drilldowns = parse_labeled_drilldowns(labeled_drilldowns,
214
+ raw_drilldowns[0])
249
215
  else
250
- name = column["name"]
251
- type = column["type"]
252
- end
253
- base_column_name = name
254
- suffix = 2
255
- while column_names.key?(name)
256
- name = "#{base_column_name}#{suffix}"
257
- suffix += 1
258
- end
259
- column_names[name] = true
260
- [name, type]
261
- end
262
-
263
- (raw_records || []).collect do |raw_record|
264
- record = Record.new
265
- columns.each_with_index do |(name, type), i|
266
- record[name] = convert_value(raw_record[i], type)
267
- end
268
- record
269
- end
270
- end
271
-
272
- def convert_value(value, type)
273
- case value
274
- when ::Array
275
- value.collect do |element|
276
- convert_value(element, type)
216
+ @drilldowns = parse_drilldowns(drilldown_keys, raw_drilldowns)
277
217
  end
278
218
  else
279
- case type
280
- when "Time"
281
- Time.at(value)
282
- else
283
- value
219
+ @n_hits, @raw_columns, @raw_records, @records =
220
+ parse_record_set_v3(body)
221
+ drilldown_keys = @command.drilldowns
222
+ labeled_drilldowns = @command.labeled_drilldowns
223
+ if labeled_drilldowns.empty?
224
+ drilldown_keys.each do |key|
225
+ labeled_drilldown =
226
+ Groonga::Command::Drilldownable::Drilldown.new
227
+ labeled_drilldown.label = key
228
+ labeled_drilldown.keys = [key]
229
+ labeled_drilldowns[key] = labeled_drilldown
230
+ end
284
231
  end
232
+ @drilldowns = parse_labeled_drilldowns(labeled_drilldowns,
233
+ body["drilldowns"])
234
+ @slices = parse_slices_v3(body["slices"])
285
235
  end
236
+ body
286
237
  end
287
238
 
288
- def parse_match_records_v1(raw_records)
239
+ def parse_record_set_v1(raw_record_set)
240
+ n_hits = raw_record_set.first.first
241
+ raw_columns = raw_record_set[1]
242
+ raw_records = raw_record_set[2..-1] || []
289
243
  [
290
- raw_records.first.first,
291
- parse_records(raw_records[1], raw_records[2..-1]),
244
+ n_hits,
245
+ raw_columns,
246
+ raw_records,
247
+ parse_records(raw_columns, raw_records),
292
248
  ]
293
249
  end
294
250
 
295
- def parse_match_records_v3(raw_records)
251
+ def parse_record_set_v3(raw_record_set)
252
+ n_hits = raw_record_set["n_hits"]
253
+ raw_columns = raw_record_set["columns"]
254
+ raw_records = raw_record_set["records"] || []
296
255
  [
297
- raw_records["n_hits"],
298
- parse_records(raw_records["columns"], raw_records["records"]),
256
+ n_hits,
257
+ raw_columns,
258
+ raw_records,
259
+ parse_records(raw_columns, raw_records),
299
260
  ]
300
261
  end
301
262
 
302
- def parse_drilldowns_v1(raw_drilldowns)
303
- request_drilldowns = @command.drilldowns
304
- if request_drilldowns.empty? and !@command.labeled_drilldowns.empty?
305
- drilldowns = {}
306
- (raw_drilldowns[0] || {}).each do |label, raw_drilldown|
307
- n_hits, records = parse_match_records_v1(raw_drilldown)
308
- drilldowns[label] = Drilldown.new(label, n_hits, records)
309
- end
310
- drilldowns
311
- else
312
- (raw_drilldowns || []).collect.with_index do |raw_drilldown, i|
313
- key = request_drilldowns[i]
314
- n_hits, records = parse_match_records_v1(raw_drilldown)
315
- Drilldown.new(key, n_hits, records)
316
- end
317
- end
318
- end
319
-
320
- def parse_drilldowns_v3(raw_drilldowns)
321
- drilldowns = {}
322
- (raw_drilldowns || {}).each do |key, raw_drilldown|
323
- n_hits, records = parse_match_records_v3(raw_drilldown)
324
- drilldowns[key] = Drilldown.new(key, n_hits, records)
325
- end
326
- drilldowns
327
- end
328
-
329
263
  def parse_slices_v1(raw_slices)
330
264
  slices = {}
331
265
  (raw_slices || {}).each do |key, raw_slice|
266
+ requested_slice = @command.slices[key]
332
267
  if raw_slice.last.is_a?(::Hash)
333
268
  raw_drilldowns = raw_slice.last
334
269
  raw_slice = raw_slice[0..-2]
335
- drilldowns = {}
336
- raw_drilldowns.each do |label, raw_drilldown|
337
- n_hits, records = parse_match_records_v1(raw_drilldown)
338
- drilldowns[label] = Drilldown.new(label, n_hits, records)
339
- end
270
+ drilldowns =
271
+ parse_labeled_drilldowns(requested_slice.labeled_drilldowns,
272
+ raw_drilldowns)
340
273
  else
341
274
  drilldowns = {}
342
275
  end
343
- n_hits, records = parse_match_records_v1(raw_slice)
276
+ n_hits, _, _, records = parse_record_set_v1(raw_slice)
344
277
  slices[key] = Slice.new(key, n_hits, records, drilldowns)
345
278
  end
346
279
  slices
@@ -349,22 +282,16 @@ module Groonga
349
282
  def parse_slices_v3(raw_slices)
350
283
  slices = {}
351
284
  (raw_slices || {}).each do |key, raw_slice|
352
- n_hits, records = parse_match_records_v3(raw_slice)
353
- drilldowns = parse_drilldowns_v3(raw_slice["drilldowns"])
285
+ requested_slice = @command.slices[key]
286
+ n_hits, _, _, records = parse_record_set_v3(raw_slice)
287
+ drilldowns =
288
+ parse_labeled_drilldowns(requested_slice.labeled_drilldowns,
289
+ raw_slice["drilldowns"])
354
290
  slices[key] = Slice.new(key, n_hits, records, drilldowns)
355
291
  end
356
292
  slices
357
293
  end
358
294
 
359
- class Record < ::Hash
360
- include Hashie::Extensions::MethodAccess
361
- end
362
-
363
- class Drilldown < Struct.new(:key, :n_hits, :records)
364
- # @deprecated since 0.2.6. Use {#records} instead.
365
- alias_method :items, :records
366
- end
367
-
368
295
  class Slice < Struct.new(:key, :n_hits, :records, :drilldowns)
369
296
  end
370
297
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2019 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  class Client
19
- VERSION = "0.6.1"
19
+ VERSION = "0.6.2"
20
20
  end
21
21
  end
@@ -414,12 +414,6 @@ class TestResponseSelectCommandVersion1 < Test::Unit::TestCase
414
414
  create_response(body).slices
415
415
  end
416
416
 
417
- def build_drilldown(label, n_hits, records)
418
- Groonga::Client::Response::Select::Drilldown.new(label,
419
- n_hits,
420
- records)
421
- end
422
-
423
417
  def collect_values(body)
424
418
  values = {}
425
419
  slices(body).each do |label, slice|
@@ -284,6 +284,7 @@ class TestResponseSelectCommandVersion3 < Test::Unit::TestCase
284
284
  def setup
285
285
  pair_arguments = {
286
286
  "slices[groonga].filter" => 'tag @ "groonga"',
287
+ "slices[groonga].drilldowns[author].keys" => "author",
287
288
  }
288
289
  @command = Groonga::Command::Select.new("select", pair_arguments)
289
290
  @body = {
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2018-2019 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,18 @@ require "response/helper"
19
19
  class TestResponseSelectTSV < Test::Unit::TestCase
20
20
  include TestResponseHelper
21
21
 
22
- def drilldown(key, n_hits, records)
23
- Groonga::Client::Response::Select::Drilldown.new(key, n_hits, records)
22
+ def drilldown(label,
23
+ keys,
24
+ n_hits,
25
+ records,
26
+ raw_columns,
27
+ raw_records)
28
+ Groonga::Client::Response::Select::Drilldown.new(label,
29
+ keys,
30
+ n_hits,
31
+ records,
32
+ raw_columns,
33
+ raw_records)
24
34
  end
25
35
 
26
36
  def test_error
@@ -113,7 +123,19 @@ END
113
123
  :elapsed_time => 0.0,
114
124
  :records => [],
115
125
  :drilldowns => [
116
- drilldown("version", 7, drilldown_records),
126
+ drilldown("version",
127
+ ["version"],
128
+ 7,
129
+ drilldown_records,
130
+ [
131
+ ["_key", "ShortText"],
132
+ ["_nsubrecs", "UInt32"],
133
+ ],
134
+ [
135
+ ["2.2.0", "18044"],
136
+ ["2.3.0", "18115"],
137
+ ["2.4.0", "14594"],
138
+ ]),
117
139
  ],
118
140
  },
119
141
  {
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2017-2019 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -19,8 +19,18 @@ require "response/helper"
19
19
  class TestResponseSelectXML < Test::Unit::TestCase
20
20
  include TestResponseHelper
21
21
 
22
- def drilldown(key, n_hits, records)
23
- Groonga::Client::Response::Select::Drilldown.new(key, n_hits, records)
22
+ def drilldown(label,
23
+ keys,
24
+ n_hits,
25
+ records,
26
+ raw_columns,
27
+ raw_records)
28
+ Groonga::Client::Response::Select::Drilldown.new(label,
29
+ keys,
30
+ n_hits,
31
+ records,
32
+ raw_columns,
33
+ raw_records)
24
34
  end
25
35
 
26
36
  def test_basic
@@ -91,7 +101,19 @@ class TestResponseSelectXML < Test::Unit::TestCase
91
101
  :elapsed_time => 0.0,
92
102
  :records => [],
93
103
  :drilldowns => [
94
- drilldown("version", 7, drilldown_records),
104
+ drilldown("version",
105
+ ["version"],
106
+ 7,
107
+ drilldown_records,
108
+ [
109
+ ["_key", "ShortText"],
110
+ ["_nsubrecs", "ShortText"],
111
+ ],
112
+ [
113
+ ["2.2.0", "18044"],
114
+ ["2.3.0", "18115"],
115
+ ["2.4.0", "14594"],
116
+ ]),
95
117
  ],
96
118
  },
97
119
  {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haruka Yoshihara
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-07-27 00:00:00.000000000 Z
13
+ date: 2019-09-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gqtp
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.2.8
35
+ version: 1.4.5
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.2.8
42
+ version: 1.4.5
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: groonga-command-parser
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -209,6 +209,7 @@ files:
209
209
  - lib/groonga/client/response/column-rename.rb
210
210
  - lib/groonga/client/response/defrag.rb
211
211
  - lib/groonga/client/response/delete.rb
212
+ - lib/groonga/client/response/drilldownable.rb
212
213
  - lib/groonga/client/response/dump.rb
213
214
  - lib/groonga/client/response/error.rb
214
215
  - lib/groonga/client/response/load.rb
@@ -216,9 +217,12 @@ files:
216
217
  - lib/groonga/client/response/log-level.rb
217
218
  - lib/groonga/client/response/log-put.rb
218
219
  - lib/groonga/client/response/log-reopen.rb
220
+ - lib/groonga/client/response/logical-range-filter.rb
221
+ - lib/groonga/client/response/logical-select.rb
219
222
  - lib/groonga/client/response/quit.rb
220
223
  - lib/groonga/client/response/register.rb
221
224
  - lib/groonga/client/response/schema.rb
225
+ - lib/groonga/client/response/searchable.rb
222
226
  - lib/groonga/client/response/select.rb
223
227
  - lib/groonga/client/response/status.rb
224
228
  - lib/groonga/client/response/table-create.rb