groonga-command 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +8 -0
- data/lib/groonga/command/load.rb +8 -0
- data/lib/groonga/command/select.rb +30 -0
- data/lib/groonga/command/version.rb +1 -1
- data/test/command/test-load.rb +19 -0
- data/test/command/test-select.rb +21 -0
- metadata +41 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa89d09d8efc12ca74d48129881d5a327995e1b
|
4
|
+
data.tar.gz: 2ef702ff862788373a4208fd34342797fe6e6256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8a28ba413387eaaeae03810c0d4229b7e4412c76a855bb4563abe1bc1a89a4c4851d88ad8fe6f1690a97110aaaffdefaac581379e6b01452936f89bf4eb2654
|
7
|
+
data.tar.gz: 9f4ad75123c52bdd7a9e73e2dcc44d34705cca63de756b84aea774889393a982f868d9ccec5036a9e85960bf3c9130c9adebee83c318a380436a5a62c91b4f8f
|
data/doc/text/news.md
CHANGED
data/lib/groonga/command/load.rb
CHANGED
@@ -36,6 +36,7 @@ module Groonga
|
|
36
36
|
:ifexists,
|
37
37
|
:input_type,
|
38
38
|
:each,
|
39
|
+
:output_ids,
|
39
40
|
]
|
40
41
|
end
|
41
42
|
end
|
@@ -58,6 +59,13 @@ module Groonga
|
|
58
59
|
@columns ||= parse_columns(self[:columns])
|
59
60
|
end
|
60
61
|
|
62
|
+
# @return [Boolean] `true` if `output_ids` value is `"yes"`.
|
63
|
+
#
|
64
|
+
# @since 1.3.0
|
65
|
+
def output_ids?
|
66
|
+
self[:output_ids] == "yes"
|
67
|
+
end
|
68
|
+
|
61
69
|
private
|
62
70
|
def parse_values(values)
|
63
71
|
return values if values.nil?
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
# Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
2
3
|
#
|
3
4
|
# This library is free software; you can redistribute it and/or
|
4
5
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -106,6 +107,13 @@ module Groonga
|
|
106
107
|
@labeled_drilldowns ||= parse_labeled_drilldowns
|
107
108
|
end
|
108
109
|
|
110
|
+
# @return [::Hash<String, Select>] The slices.
|
111
|
+
#
|
112
|
+
# @since 1.3.0
|
113
|
+
def slices
|
114
|
+
@slices ||= parse_slices
|
115
|
+
end
|
116
|
+
|
109
117
|
def output_columns
|
110
118
|
self[:output_columns]
|
111
119
|
end
|
@@ -157,6 +165,28 @@ module Groonga
|
|
157
165
|
labeled_drilldowns
|
158
166
|
end
|
159
167
|
|
168
|
+
def parse_slices
|
169
|
+
raw_slices = {}
|
170
|
+
@arguments.each do |name, value|
|
171
|
+
case name.to_s
|
172
|
+
when /\Aslices?\[(.+?)\]\.(.+?)\z/
|
173
|
+
label = $1
|
174
|
+
parameter_name = $2
|
175
|
+
raw_slices[label] ||= {}
|
176
|
+
raw_slices[label][parameter_name] = value
|
177
|
+
end
|
178
|
+
end
|
179
|
+
build_slices(raw_slices)
|
180
|
+
end
|
181
|
+
|
182
|
+
def build_slices(raw_slices)
|
183
|
+
slices = {}
|
184
|
+
raw_slices.each do |label, raw_slice|
|
185
|
+
slices[label] = Select.new(raw_slice)
|
186
|
+
end
|
187
|
+
slices
|
188
|
+
end
|
189
|
+
|
160
190
|
class Drilldown < Struct.new(:keys,
|
161
191
|
:sort_keys,
|
162
192
|
:output_columns,
|
data/test/command/test-load.rb
CHANGED
@@ -31,6 +31,7 @@ class LoadCommandTest < Test::Unit::TestCase
|
|
31
31
|
ifexists = "_key == \"Alice\""
|
32
32
|
input_type = "json"
|
33
33
|
each = "strlen(_key)"
|
34
|
+
output_ids = "no"
|
34
35
|
|
35
36
|
ordered_arguments = [
|
36
37
|
values,
|
@@ -39,6 +40,7 @@ class LoadCommandTest < Test::Unit::TestCase
|
|
39
40
|
ifexists,
|
40
41
|
input_type,
|
41
42
|
each,
|
43
|
+
output_ids,
|
42
44
|
]
|
43
45
|
command = load_command({}, ordered_arguments)
|
44
46
|
assert_equal({
|
@@ -48,6 +50,7 @@ class LoadCommandTest < Test::Unit::TestCase
|
|
48
50
|
:ifexists => ifexists,
|
49
51
|
:input_type => input_type,
|
50
52
|
:each => each,
|
53
|
+
:output_ids => output_ids,
|
51
54
|
},
|
52
55
|
command.arguments)
|
53
56
|
end
|
@@ -87,4 +90,20 @@ class LoadCommandTest < Test::Unit::TestCase
|
|
87
90
|
})
|
88
91
|
end
|
89
92
|
end
|
93
|
+
|
94
|
+
class OutputIDsTest < self
|
95
|
+
def test_specified
|
96
|
+
command = load_command({"output_ids" => "yes"})
|
97
|
+
assert do
|
98
|
+
command.output_ids?
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_omitted
|
103
|
+
command = load_command
|
104
|
+
assert do
|
105
|
+
not command.output_ids?
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
90
109
|
end
|
data/test/command/test-select.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Copyright (C) 2011-2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
# Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
2
3
|
#
|
3
4
|
# This library is free software; you can redistribute it and/or
|
4
5
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -216,4 +217,24 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
216
217
|
drilldown
|
217
218
|
end
|
218
219
|
end
|
220
|
+
|
221
|
+
class SlicesTest < self
|
222
|
+
def test_multiple
|
223
|
+
parameters = {
|
224
|
+
"slices[groonga].query" => "tag:Groonga",
|
225
|
+
"slices[rroonga].filter" => "tag == Rroonga",
|
226
|
+
"slices[rroonga].sort_keys" => "date",
|
227
|
+
"slices[rroonga].output_columns" => "_key, date",
|
228
|
+
}
|
229
|
+
command = select_command(parameters)
|
230
|
+
|
231
|
+
slices = {
|
232
|
+
"groonga" => select_command(:query => "tag:Groonga"),
|
233
|
+
"rroonga" => select_command(:filter => "tag == Rroonga",
|
234
|
+
:sort_keys => "date",
|
235
|
+
:output_columns => "_key, date"),
|
236
|
+
}
|
237
|
+
assert_equal(slices, command.slices)
|
238
|
+
end
|
239
|
+
end
|
219
240
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -266,54 +266,54 @@ specification_version: 4
|
|
266
266
|
summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
|
267
267
|
command. You can write a program that handle Groonga's command by using groonga-command.
|
268
268
|
test_files:
|
269
|
-
- test/
|
270
|
-
- test/command/test-
|
271
|
-
- test/command/test-
|
272
|
-
- test/command/test-
|
269
|
+
- test/run-test.rb
|
270
|
+
- test/command/test-column-rename.rb
|
271
|
+
- test/command/test-table-remove.rb
|
272
|
+
- test/command/test-object-inspect.rb
|
273
|
+
- test/command/test-truncate.rb
|
273
274
|
- test/command/test-reindex.rb
|
274
|
-
- test/command/test-
|
275
|
-
- test/command/test-
|
276
|
-
- test/command/test-base.rb
|
277
|
-
- test/command/test-logical-count.rb
|
275
|
+
- test/command/test-normalize.rb
|
276
|
+
- test/command/test-tokenize.rb
|
278
277
|
- test/command/test-table-rename.rb
|
279
|
-
- test/command/test-
|
278
|
+
- test/command/test-logical-range-filter.rb
|
280
279
|
- test/command/test-dump.rb
|
281
|
-
- test/command/test-
|
280
|
+
- test/command/test-suggest.rb
|
281
|
+
- test/command/test-request-cancel.rb
|
282
|
+
- test/command/test-config-set.rb
|
283
|
+
- test/command/test-get.rb
|
284
|
+
- test/command/test-query-expand.rb
|
285
|
+
- test/command/test-logical-select.rb
|
286
|
+
- test/command/test-column-create.rb
|
287
|
+
- test/command/test-log-put.rb
|
282
288
|
- test/command/test-config-get.rb
|
289
|
+
- test/command/test-log-level.rb
|
290
|
+
- test/command/test-column-list.rb
|
283
291
|
- test/command/test-register.rb
|
292
|
+
- test/command/test-ruby-eval.rb
|
293
|
+
- test/command/test-plugin-register.rb
|
294
|
+
- test/command/test-table-list.rb
|
295
|
+
- test/command/test-logical-table-remove.rb
|
296
|
+
- test/command/test-config-delete.rb
|
284
297
|
- test/command/test-shutdown.rb
|
285
|
-
- test/command/test-
|
286
|
-
- test/command/test-
|
287
|
-
- test/command/test-
|
288
|
-
- test/command/test-log-put.rb
|
298
|
+
- test/command/test-io-flush.rb
|
299
|
+
- test/command/test-table-create.rb
|
300
|
+
- test/command/test-ruby-load.rb
|
289
301
|
- test/command/test-load.rb
|
290
|
-
- test/command/test-
|
291
|
-
- test/command/test-
|
292
|
-
- test/command/test-
|
293
|
-
- test/command/test-column-
|
294
|
-
- test/command/test-
|
295
|
-
- test/command/test-logical-range-filter.rb
|
296
|
-
- test/command/test-object-inspect.rb
|
302
|
+
- test/command/test-delete.rb
|
303
|
+
- test/command/test-select.rb
|
304
|
+
- test/command/test-plugin-unregister.rb
|
305
|
+
- test/command/test-column-remove.rb
|
306
|
+
- test/command/test-range-filter.rb
|
297
307
|
- test/command/format/test-command.rb
|
298
|
-
- test/command/test-
|
299
|
-
- test/command/test-
|
300
|
-
- test/command/test-thread-limit.rb
|
301
|
-
- test/command/test-table-list.rb
|
308
|
+
- test/command/test-column-copy.rb
|
309
|
+
- test/command/test-base.rb
|
302
310
|
- test/command/test-object-exist.rb
|
303
|
-
- test/command/test-log-level.rb
|
304
|
-
- test/command/test-range-filter.rb
|
305
311
|
- test/command/test-status.rb
|
306
|
-
- test/command/test-
|
312
|
+
- test/command/test-thread-limit.rb
|
307
313
|
- test/command/test-schema.rb
|
308
|
-
- test/command/test-
|
309
|
-
- test/command/test-
|
310
|
-
- test/command/test-column-remove.rb
|
311
|
-
- test/command/test-ruby-eval.rb
|
312
|
-
- test/command/test-table-create.rb
|
313
|
-
- test/command/test-table-remove.rb
|
314
|
-
- test/command/test-ruby-load.rb
|
314
|
+
- test/command/test-table-tokenize.rb
|
315
|
+
- test/command/test-logical-shard-list.rb
|
315
316
|
- test/command/test-table-copy.rb
|
316
|
-
- test/command/test-
|
317
|
-
- test/command/test-
|
318
|
-
- test/command
|
319
|
-
- test/run-test.rb
|
317
|
+
- test/command/test-object-remove.rb
|
318
|
+
- test/command/test-logical-count.rb
|
319
|
+
- test/groonga-command-test-utils.rb
|