groonga-command 1.3.0 → 1.3.1
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 +13 -0
- data/lib/groonga/command/base.rb +9 -0
- data/lib/groonga/command/column-create.rb +2 -2
- data/lib/groonga/command/normalize.rb +1 -1
- data/lib/groonga/command/query-expand.rb +1 -1
- data/lib/groonga/command/select.rb +37 -4
- data/lib/groonga/command/table-create.rb +2 -2
- data/lib/groonga/command/table-tokenize.rb +1 -1
- data/lib/groonga/command/tokenize.rb +2 -2
- data/lib/groonga/command/version.rb +1 -1
- data/test/command/test-select.rb +48 -6
- data/test/command/test-table-create.rb +1 -1
- 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: 825e111ecaa00e1ab59e8d94d960c7d0c74ed1c5
|
4
|
+
data.tar.gz: 8cd981a313f1ff936e55f381b34103cf07bf6d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa021d38662c0d566a6ef81beb5eda9167cbae3b51372f394266ce54636a432bc371166d6239c1a37e4398564352c6b6fe8b9eade91e70fd61f96a2697edf250
|
7
|
+
data.tar.gz: 1a95dfb5a3edbe0153e91d8620724ae09cb75ddced9dac0ff24480d288642bc1d6f5ae8e94524cf6e58ba45400ce8fa56056aa1cac22f077130517e05427cbab
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.3.1: 2016-12-08
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* {Groonga::Command::Select#slices}: Changed return value from
|
8
|
+
`Hash<String, Groonga::Command::Select>` to `Hash<String,
|
9
|
+
Groonga::Command::Select::Slice`.
|
10
|
+
|
11
|
+
### Fixes
|
12
|
+
|
13
|
+
* {Groonga::Command::TableCreate#token_filters}: Fixed a bug that
|
14
|
+
multiple token filters can't be parsed.
|
15
|
+
|
3
16
|
## 1.3.0: 2016-12-08
|
4
17
|
|
5
18
|
### Improvements
|
data/lib/groonga/command/base.rb
CHANGED
@@ -206,6 +206,15 @@ module Groonga
|
|
206
206
|
return nil if value.nil?
|
207
207
|
value.strip.split(/\s*,\s*/)
|
208
208
|
end
|
209
|
+
|
210
|
+
def flags_value(name)
|
211
|
+
parse_flags_value(self[name] || "")
|
212
|
+
end
|
213
|
+
|
214
|
+
def parse_flags_value(value)
|
215
|
+
return nil if value.nil?
|
216
|
+
value.strip.split(/\s*[| ]\s*/)
|
217
|
+
end
|
209
218
|
end
|
210
219
|
end
|
211
220
|
end
|
@@ -51,7 +51,7 @@ module Groonga
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def flags
|
54
|
-
@flags ||= (
|
54
|
+
@flags ||= flags_value(:flags)
|
55
55
|
end
|
56
56
|
|
57
57
|
# @return [String] value type name of the column.
|
@@ -108,7 +108,7 @@ module Groonga
|
|
108
108
|
#
|
109
109
|
# @since 1.0.7
|
110
110
|
def sources
|
111
|
-
@sources ||= (
|
111
|
+
@sources ||= array_value(:source)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -107,7 +107,7 @@ module Groonga
|
|
107
107
|
@labeled_drilldowns ||= parse_labeled_drilldowns
|
108
108
|
end
|
109
109
|
|
110
|
-
# @return [::Hash<String,
|
110
|
+
# @return [::Hash<String, Slice>] The slices.
|
111
111
|
#
|
112
112
|
# @since 1.3.0
|
113
113
|
def slices
|
@@ -159,7 +159,8 @@ module Groonga
|
|
159
159
|
offset,
|
160
160
|
limit,
|
161
161
|
calc_types,
|
162
|
-
calc_target
|
162
|
+
calc_target,
|
163
|
+
label)
|
163
164
|
labeled_drilldowns[label] = drilldown
|
164
165
|
end
|
165
166
|
labeled_drilldowns
|
@@ -182,7 +183,25 @@ module Groonga
|
|
182
183
|
def build_slices(raw_slices)
|
183
184
|
slices = {}
|
184
185
|
raw_slices.each do |label, raw_slice|
|
185
|
-
|
186
|
+
match_columns = raw_slice["match_columns"]
|
187
|
+
query = raw_slice["query"]
|
188
|
+
query_expander = raw_slice["query_expander"]
|
189
|
+
query_flags = parse_flags_value(raw_slice["query_flags"])
|
190
|
+
filter = raw_slice["filter"]
|
191
|
+
sort_keys = parse_array_value(raw_slice["sort_keys"])
|
192
|
+
output_columns = parse_array_value(raw_slice["output_columns"])
|
193
|
+
offset = parse_integer_value(raw_slice["offset"])
|
194
|
+
limit = parse_integer_value(raw_slice["limit"])
|
195
|
+
slices[label] = Slice.new(label,
|
196
|
+
match_columns,
|
197
|
+
query,
|
198
|
+
query_expander,
|
199
|
+
query_flags,
|
200
|
+
filter,
|
201
|
+
sort_keys,
|
202
|
+
output_columns,
|
203
|
+
offset,
|
204
|
+
limit)
|
186
205
|
end
|
187
206
|
slices
|
188
207
|
end
|
@@ -193,7 +212,21 @@ module Groonga
|
|
193
212
|
:offset,
|
194
213
|
:limit,
|
195
214
|
:calc_types,
|
196
|
-
:calc_target
|
215
|
+
:calc_target,
|
216
|
+
:label)
|
217
|
+
end
|
218
|
+
|
219
|
+
# @since 1.3.1
|
220
|
+
class Slice < Struct.new(:label,
|
221
|
+
:match_columns,
|
222
|
+
:query,
|
223
|
+
:query_expander,
|
224
|
+
:query_flags,
|
225
|
+
:filter,
|
226
|
+
:sort_keys,
|
227
|
+
:output_columns,
|
228
|
+
:offset,
|
229
|
+
:limit)
|
197
230
|
end
|
198
231
|
end
|
199
232
|
end
|
@@ -62,7 +62,7 @@ module Groonga
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def flags
|
65
|
-
@flags ||= (
|
65
|
+
@flags ||= flags_value(:flags)
|
66
66
|
end
|
67
67
|
|
68
68
|
# @return [Boolean] true if "TABLE_NO_KEY" is specified in {#flags},
|
@@ -115,7 +115,7 @@ module Groonga
|
|
115
115
|
# @return [::Array<String>] Token filter names.
|
116
116
|
# @since 1.2.1
|
117
117
|
def token_filters
|
118
|
-
@token_filters ||= (
|
118
|
+
@token_filters ||= array_value(:token_filters)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -68,7 +68,7 @@ module Groonga
|
|
68
68
|
#
|
69
69
|
# @since 1.0.6
|
70
70
|
def flags
|
71
|
-
@flags ||= (
|
71
|
+
@flags ||= flags_value(:flags)
|
72
72
|
end
|
73
73
|
|
74
74
|
# @return [String] `mode` parameter value.
|
@@ -85,7 +85,7 @@ module Groonga
|
|
85
85
|
#
|
86
86
|
# @since 1.1.0
|
87
87
|
def token_filters
|
88
|
-
@token_filters ||= (
|
88
|
+
@token_filters ||= array_value(:token_filters)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
data/test/command/test-select.rb
CHANGED
@@ -186,13 +186,15 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
186
186
|
}
|
187
187
|
command = select_command(parameters)
|
188
188
|
drilldowns = {
|
189
|
-
"author_tag" => drilldown(:
|
189
|
+
"author_tag" => drilldown(:label => "author_tag",
|
190
|
+
:keys => ["author", "tag"],
|
190
191
|
:sort_keys => ["_value.author"],
|
191
192
|
:output_columns => [
|
192
193
|
"_value.author",
|
193
194
|
"_nsubrecs",
|
194
195
|
]),
|
195
|
-
"tag" => drilldown(:
|
196
|
+
"tag" => drilldown(:label => "tag",
|
197
|
+
:keys => ["tag"],
|
196
198
|
:sort_keys => ["-_nsubrecs", "_key"],
|
197
199
|
:output_columns => [
|
198
200
|
"_key",
|
@@ -219,6 +221,36 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
219
221
|
end
|
220
222
|
|
221
223
|
class SlicesTest < self
|
224
|
+
def test_full
|
225
|
+
parameters = {
|
226
|
+
"slices[book_alice].match_columns" => "tag",
|
227
|
+
"slices[book_alice].query" => "Book",
|
228
|
+
"slices[book_alice].query_expander" => "Synonyms.tag",
|
229
|
+
"slices[book_alice].query_flags" => "ALLOW_COLUMN|ALLOW_LEADING_NOT",
|
230
|
+
"slices[book_alice].filter" => "user == \"alice\"",
|
231
|
+
"slices[book_alice].sort_keys" => "_score, user",
|
232
|
+
"slices[book_alice].offset" => "10",
|
233
|
+
"slices[book_alice].limit" => "25",
|
234
|
+
}
|
235
|
+
command = select_command(parameters)
|
236
|
+
|
237
|
+
slices = {
|
238
|
+
"book_alice" => slice(:label => "book_alice",
|
239
|
+
:match_columns => "tag",
|
240
|
+
:query => "Book",
|
241
|
+
:query_expander => "Synonyms.tag",
|
242
|
+
:query_flags => [
|
243
|
+
"ALLOW_COLUMN",
|
244
|
+
"ALLOW_LEADING_NOT",
|
245
|
+
],
|
246
|
+
:filter => "user == \"alice\"",
|
247
|
+
:sort_keys => ["_score", "user"],
|
248
|
+
:offset => 10,
|
249
|
+
:limit => 25),
|
250
|
+
}
|
251
|
+
assert_equal(slices, command.slices)
|
252
|
+
end
|
253
|
+
|
222
254
|
def test_multiple
|
223
255
|
parameters = {
|
224
256
|
"slices[groonga].query" => "tag:Groonga",
|
@@ -229,12 +261,22 @@ class SelectCommandTest < Test::Unit::TestCase
|
|
229
261
|
command = select_command(parameters)
|
230
262
|
|
231
263
|
slices = {
|
232
|
-
"groonga" =>
|
233
|
-
|
234
|
-
|
235
|
-
|
264
|
+
"groonga" => slice(:label => "groonga",
|
265
|
+
:query => "tag:Groonga"),
|
266
|
+
"rroonga" => slice(:label => "rroonga",
|
267
|
+
:filter => "tag == Rroonga",
|
268
|
+
:sort_keys => ["date"],
|
269
|
+
:output_columns => ["_key", "date"]),
|
236
270
|
}
|
237
271
|
assert_equal(slices, command.slices)
|
238
272
|
end
|
273
|
+
|
274
|
+
def slice(parameters)
|
275
|
+
slice = Groonga::Command::Select::Slice.new
|
276
|
+
parameters.each do |key, value|
|
277
|
+
slice[key] = value
|
278
|
+
end
|
279
|
+
slice
|
280
|
+
end
|
239
281
|
end
|
240
282
|
end
|
@@ -209,7 +209,7 @@ class TableCreateCommandTest < Test::Unit::TestCase
|
|
209
209
|
class TokenFiltersTest < self
|
210
210
|
def test_multiple
|
211
211
|
arguments = {
|
212
|
-
"token_filters" => "TokenFilterStopWord
|
212
|
+
"token_filters" => "TokenFilterStopWord,TokenFilterStem",
|
213
213
|
}
|
214
214
|
command = table_create_command(arguments)
|
215
215
|
assert_equal(["TokenFilterStopWord", "TokenFilterStem"],
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -260,60 +260,60 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.5.
|
263
|
+
rubygems_version: 2.5.2
|
264
264
|
signing_key:
|
265
265
|
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-
|
273
|
-
- test/command/test-truncate.rb
|
269
|
+
- test/groonga-command-test-utils.rb
|
270
|
+
- test/command/test-config-delete.rb
|
271
|
+
- test/command/test-object-remove.rb
|
272
|
+
- test/command/test-table-tokenize.rb
|
274
273
|
- test/command/test-reindex.rb
|
275
|
-
- test/command/test-
|
276
|
-
- test/command/test-
|
274
|
+
- test/command/test-plugin-unregister.rb
|
275
|
+
- test/command/test-io-flush.rb
|
276
|
+
- test/command/test-base.rb
|
277
|
+
- test/command/test-logical-count.rb
|
277
278
|
- test/command/test-table-rename.rb
|
278
|
-
- test/command/test-
|
279
|
+
- test/command/test-column-rename.rb
|
279
280
|
- test/command/test-dump.rb
|
280
|
-
- test/command/test-
|
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
|
281
|
+
- test/command/test-normalize.rb
|
288
282
|
- test/command/test-config-get.rb
|
289
|
-
- test/command/test-log-level.rb
|
290
|
-
- test/command/test-column-list.rb
|
291
283
|
- 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
|
297
284
|
- test/command/test-shutdown.rb
|
298
|
-
- test/command/test-io-flush.rb
|
299
|
-
- test/command/test-table-create.rb
|
300
|
-
- test/command/test-ruby-load.rb
|
301
|
-
- test/command/test-load.rb
|
302
285
|
- 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
|
307
|
-
- test/command/format/test-command.rb
|
308
286
|
- test/command/test-column-copy.rb
|
309
|
-
- test/command/test-
|
287
|
+
- test/command/test-tokenize.rb
|
288
|
+
- test/command/test-log-put.rb
|
289
|
+
- test/command/test-load.rb
|
290
|
+
- test/command/test-column-list.rb
|
291
|
+
- test/command/test-plugin-register.rb
|
292
|
+
- test/command/test-request-cancel.rb
|
293
|
+
- test/command/test-column-create.rb
|
294
|
+
- test/command/test-config-set.rb
|
295
|
+
- test/command/test-logical-range-filter.rb
|
296
|
+
- test/command/test-object-inspect.rb
|
297
|
+
- test/command/format/test-command.rb
|
298
|
+
- test/command/test-logical-select.rb
|
299
|
+
- test/command/test-get.rb
|
300
|
+
- test/command/test-thread-limit.rb
|
301
|
+
- test/command/test-table-list.rb
|
310
302
|
- test/command/test-object-exist.rb
|
303
|
+
- test/command/test-log-level.rb
|
304
|
+
- test/command/test-range-filter.rb
|
311
305
|
- test/command/test-status.rb
|
312
|
-
- test/command/test-thread-limit.rb
|
313
|
-
- test/command/test-schema.rb
|
314
|
-
- test/command/test-table-tokenize.rb
|
315
306
|
- test/command/test-logical-shard-list.rb
|
307
|
+
- test/command/test-schema.rb
|
308
|
+
- test/command/test-suggest.rb
|
309
|
+
- test/command/test-select.rb
|
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
|
316
315
|
- test/command/test-table-copy.rb
|
317
|
-
- test/command/test-
|
318
|
-
- test/command/test-
|
319
|
-
- test/
|
316
|
+
- test/command/test-query-expand.rb
|
317
|
+
- test/command/test-truncate.rb
|
318
|
+
- test/command/test-logical-table-remove.rb
|
319
|
+
- test/run-test.rb
|