groonga-client 0.5.9 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2020 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.5.9"
19
+ VERSION = "0.6.4"
20
20
  end
21
21
  end
@@ -186,8 +186,8 @@ class TestRequestSelect < Test::Unit::TestCase
186
186
  end
187
187
 
188
188
  sub_test_case("#paginate") do
189
- def paginate(*args)
190
- @request.paginate(*args).to_parameters
189
+ def paginate(*args, **kwargs)
190
+ @request.paginate(*args, **kwargs).to_parameters
191
191
  end
192
192
 
193
193
  sub_test_case("page") do
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2018 Kouhei Sutou <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
@@ -210,4 +210,17 @@ class TestResponseBase < Test::Unit::TestCase
210
210
  end
211
211
  end
212
212
  end
213
+
214
+ class TestParse < self
215
+ def test_jsonp
216
+ command = Groonga::Command::Base.new("status", {"callback" => "a"})
217
+ response = [
218
+ [0, 1396012478, 0.00050806999206543],
219
+ {"start_time" => 1396012478},
220
+ ]
221
+ raw_response = "a(#{response.to_json});"
222
+ response = Groonga::Client::Response::Base.parse(command, raw_response)
223
+ assert_equal(1396012478, response.body["start_time"])
224
+ end
225
+ end
213
226
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2013 Kosuke Asami
3
3
  # Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
4
4
  #
@@ -320,12 +320,14 @@ class TestResponseSelectCommandVersion1 < Test::Unit::TestCase
320
320
  class TestSlices < self
321
321
  def setup
322
322
  pair_arguments = {
323
- "slices[groonga].filter" => 'tag @ "groonga"',
323
+ "slices[groonga].filter" => "tag @ 'groonga'",
324
+ "slices[groonga].limit" => "2",
325
+ "slices[groonga].drilldowns[author].keys" => "author",
324
326
  }
325
327
  @command = Groonga::Command::Select.new("select", pair_arguments)
326
328
  @body = [
327
329
  [
328
- [3],
330
+ [4],
329
331
  [
330
332
  [
331
333
  "_id",
@@ -339,10 +341,11 @@ class TestResponseSelectCommandVersion1 < Test::Unit::TestCase
339
341
  [1, "groonga"],
340
342
  [2, "rroonga"],
341
343
  [3, "groonga"],
344
+ [4, "groonga"],
342
345
  ],
343
346
  {
344
347
  "groonga" => [
345
- [2],
348
+ [3],
346
349
  [
347
350
  [
348
351
  "_id",
@@ -355,19 +358,55 @@ class TestResponseSelectCommandVersion1 < Test::Unit::TestCase
355
358
  ],
356
359
  [1, "groonga"],
357
360
  [3, "groonga"],
358
- ]
359
- }
361
+ {
362
+ "author" => [
363
+ [3],
364
+ [
365
+ [
366
+ "_key",
367
+ "ShortText",
368
+ ],
369
+ [
370
+ "_nsubrecs",
371
+ "Int32",
372
+ ],
373
+ ],
374
+ [
375
+ "Alice",
376
+ 1,
377
+ ],
378
+ [
379
+ "Bob",
380
+ 1,
381
+ ],
382
+ [
383
+ "Chris",
384
+ 1,
385
+ ],
386
+ ],
387
+ },
388
+ ],
389
+ },
360
390
  ]
361
391
  end
362
392
 
363
393
  def test_slices
364
394
  assert_equal({
365
- "groonga" => [
366
- {"_id" => 1, "tag" => "groonga"},
367
- {"_id" => 3, "tag" => "groonga"},
368
- ]
395
+ "groonga" => {
396
+ records: [
397
+ {"_id" => 1, "tag" => "groonga"},
398
+ {"_id" => 3, "tag" => "groonga"},
399
+ ],
400
+ drilldowns: {
401
+ "author" => [
402
+ {"_key" => "Alice", "_nsubrecs" => 1},
403
+ {"_key" => "Bob", "_nsubrecs" => 1},
404
+ {"_key" => "Chris", "_nsubrecs" => 1},
405
+ ],
406
+ },
407
+ },
369
408
  },
370
- collect_values(@body, &:records))
409
+ collect_values(@body))
371
410
  end
372
411
 
373
412
  private
@@ -378,7 +417,14 @@ class TestResponseSelectCommandVersion1 < Test::Unit::TestCase
378
417
  def collect_values(body)
379
418
  values = {}
380
419
  slices(body).each do |label, slice|
381
- values[label] = yield(slice)
420
+ drilldowns = {}
421
+ slice.drilldowns.each do |drilldown_label, drilldown|
422
+ drilldowns[drilldown_label] = drilldown.records
423
+ end
424
+ values[label] = {
425
+ records: slice.records,
426
+ drilldowns: drilldowns,
427
+ }
382
428
  end
383
429
  values
384
430
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2013 Kosuke Asami
3
3
  # Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
4
4
  #
@@ -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 = {
@@ -319,7 +320,36 @@ class TestResponseSelectCommandVersion3 < Test::Unit::TestCase
319
320
  "records" => [
320
321
  [1, "groonga"],
321
322
  [3, "groonga"],
322
- ]
323
+ ],
324
+ "drilldowns" => {
325
+ "author" => {
326
+ "n_hits" => 3,
327
+ "columns" => [
328
+ {
329
+ "name" => "_key",
330
+ "type" => "ShortText",
331
+ },
332
+ {
333
+ "name" => "_nsubrecs",
334
+ "type" => "Int32",
335
+ },
336
+ ],
337
+ "records" => [
338
+ [
339
+ "Alice",
340
+ 1,
341
+ ],
342
+ [
343
+ "Bob",
344
+ 1,
345
+ ],
346
+ [
347
+ "Chris",
348
+ 1,
349
+ ],
350
+ ],
351
+ },
352
+ },
323
353
  }
324
354
  }
325
355
  }
@@ -327,12 +357,21 @@ class TestResponseSelectCommandVersion3 < Test::Unit::TestCase
327
357
 
328
358
  def test_slices
329
359
  assert_equal({
330
- "groonga" => [
331
- {"_id" => 1, "tag" => "groonga"},
332
- {"_id" => 3, "tag" => "groonga"},
333
- ]
360
+ "groonga" => {
361
+ records: [
362
+ {"_id" => 1, "tag" => "groonga"},
363
+ {"_id" => 3, "tag" => "groonga"},
364
+ ],
365
+ drilldowns: {
366
+ "author" => [
367
+ {"_key" => "Alice", "_nsubrecs" => 1},
368
+ {"_key" => "Bob", "_nsubrecs" => 1},
369
+ {"_key" => "Chris", "_nsubrecs" => 1},
370
+ ],
371
+ },
372
+ },
334
373
  },
335
- collect_values(@body, &:records))
374
+ collect_values(@body))
336
375
  end
337
376
 
338
377
  private
@@ -343,7 +382,14 @@ class TestResponseSelectCommandVersion3 < Test::Unit::TestCase
343
382
  def collect_values(body)
344
383
  values = {}
345
384
  slices(body).each do |label, slice|
346
- values[label] = yield(slice)
385
+ drilldowns = {}
386
+ slice.drilldowns.each do |drilldown_label, drilldown|
387
+ drilldowns[drilldown_label] = drilldown.records
388
+ end
389
+ values[label] = {
390
+ records: slice.records,
391
+ drilldowns: drilldowns,
392
+ }
347
393
  end
348
394
  values
349
395
  end
@@ -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.5.9
4
+ version: 0.6.4
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: 2018-07-13 00:00:00.000000000 Z
13
+ date: 2021-02-24 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.7
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.7
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: groonga-command-parser
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,20 @@ dependencies:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: rexml
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: bundler
73
87
  requirement: !ruby/object:Gem::Requirement
@@ -161,9 +175,9 @@ email:
161
175
  - kou@clear-code.com
162
176
  - tfortress58@gmail.com
163
177
  executables:
178
+ - groonga-client
164
179
  - groonga-client-index-check
165
180
  - groonga-client-index-recreate
166
- - groonga-client
167
181
  extensions: []
168
182
  extra_rdoc_files: []
169
183
  files:
@@ -209,6 +223,7 @@ files:
209
223
  - lib/groonga/client/response/column-rename.rb
210
224
  - lib/groonga/client/response/defrag.rb
211
225
  - lib/groonga/client/response/delete.rb
226
+ - lib/groonga/client/response/drilldownable.rb
212
227
  - lib/groonga/client/response/dump.rb
213
228
  - lib/groonga/client/response/error.rb
214
229
  - lib/groonga/client/response/load.rb
@@ -216,9 +231,12 @@ files:
216
231
  - lib/groonga/client/response/log-level.rb
217
232
  - lib/groonga/client/response/log-put.rb
218
233
  - lib/groonga/client/response/log-reopen.rb
234
+ - lib/groonga/client/response/logical-range-filter.rb
235
+ - lib/groonga/client/response/logical-select.rb
219
236
  - lib/groonga/client/response/quit.rb
220
237
  - lib/groonga/client/response/register.rb
221
238
  - lib/groonga/client/response/schema.rb
239
+ - lib/groonga/client/response/searchable.rb
222
240
  - lib/groonga/client/response/select.rb
223
241
  - lib/groonga/client/response/status.rb
224
242
  - lib/groonga/client/response/table-create.rb
@@ -282,43 +300,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
300
  - !ruby/object:Gem::Version
283
301
  version: '0'
284
302
  requirements: []
285
- rubyforge_project:
286
- rubygems_version: 2.7.6
303
+ rubygems_version: 3.3.0.dev
287
304
  signing_key:
288
305
  specification_version: 4
289
306
  summary: Groonga-client is a client for Groonga (http://groonga.org/) implemented
290
307
  with pure Ruby. You can use it without Groonga.
291
308
  test_files:
292
- - test/test-client.rb
293
- - test/command-line/test-index-check.rb
294
309
  - test/command-line/helper.rb
310
+ - test/command-line/test-index-check.rb
295
311
  - test/command-line/test-index-recreate.rb
296
- - test/test-script-syntax.rb
312
+ - test/protocol/test-gqtp.rb
313
+ - test/protocol/test-http.rb
297
314
  - test/request/select/test-backward-compatible-sort-keys-parameter.rb
298
315
  - test/request/select/test-filter.rb
299
- - test/request/select/test-sort-keys-parameter.rb
300
316
  - test/request/select/test-output-columns-parameter.rb
301
- - test/request/select/test-values-parameter.rb
302
317
  - test/request/select/test-scorer.rb
303
- - test/request/test-merger.rb
318
+ - test/request/select/test-sort-keys-parameter.rb
319
+ - test/request/select/test-values-parameter.rb
304
320
  - test/request/test-generic.rb
321
+ - test/request/test-merger.rb
305
322
  - test/request/test-select.rb
306
- - test/test-command.rb
307
- - test/protocol/test-gqtp.rb
308
- - test/protocol/test-http.rb
309
- - test/run-test.rb
323
+ - test/response/helper.rb
310
324
  - test/response/test-base.rb
311
- - test/response/test-select-tsv.rb
312
- - test/response/test-load.rb
313
325
  - test/response/test-column-list.rb
314
- - test/response/helper.rb
315
326
  - test/response/test-error.rb
316
- - test/response/test-table-list.rb
317
- - test/response/test-status.rb
318
- - test/response/test-select-xml.rb
327
+ - test/response/test-load.rb
319
328
  - test/response/test-schema.rb
320
- - test/response/test-select-command-version3.rb
321
329
  - test/response/test-select-command-version1.rb
330
+ - test/response/test-select-command-version3.rb
331
+ - test/response/test-select-tsv.rb
332
+ - test/response/test-select-xml.rb
333
+ - test/response/test-status.rb
322
334
  - test/response/test-table-create.rb
335
+ - test/response/test-table-list.rb
323
336
  - test/response/test-table-remove.rb
324
337
  - test/results/test-table-list.rb
338
+ - test/run-test.rb
339
+ - test/test-client.rb
340
+ - test/test-command.rb
341
+ - test/test-script-syntax.rb