groonga-command 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d2f555370a8c3bba2991a68593c7bb398054a23e4445d46ec29dbaf2b875762
4
- data.tar.gz: f4e599c46ff4e418539b10f6e6171eb28dbcceda8c59156e2afb296b4d0b50c7
3
+ metadata.gz: 9b4f9e1034bd01512b802d2bb3e40cb35365b51379d5ce8d88c121b388d64ca0
4
+ data.tar.gz: 91d75b6923d074a9e469524301c5dd970a0aa1068beedd351ae64e6a5591a715
5
5
  SHA512:
6
- metadata.gz: 342c12272bb17b82cfa81070f87a13e0fbec393aa925feed32788c3d8702f50f033cdcc9ac06c8720edfc691fe8d50d98f013279268de20fa7415d1ecbff1dd6
7
- data.tar.gz: 11b5f90f786a5e9ed636ed88f623f7042a15c37c3c92f20f708534213037f82f5dc52814763d0a2d4930f106801bc658839eca754114809e34f574e45ee3ecaa
6
+ metadata.gz: f384098ada70451a767d8c0b662b6906b5c4fce5bd90073275b3330d7d2a1118f9fb8e05da959855920fc7b1a960b25349548f655f80408e581b6240b741e6f6
7
+ data.tar.gz: d9bb4dd1c5ab2a842ead8f94a29142222164e8f8d4b9aedd8f3985658482b435b26b6bfcc47b9373b2ddba9a459c1d8d28a0dcf015de47012a583f20fbe188c6
data/doc/text/news.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # News
2
2
 
3
+ ## 1.4.3: 2019-09-02
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::LogicalRangeFilter#use_range_index}: Added.
8
+
9
+ * {Groonga::Command::LogicalRangeFilter#post_filter}: Added.
10
+
11
+ * {Groonga::Command::LogicalRangeFilter#sort_keys}: Added.
12
+
3
13
  ## 1.4.2: 2019-08-21
4
14
 
5
15
  ### Improvements
@@ -232,15 +232,22 @@ module Groonga
232
232
  value.strip.split(/\s*[| ]\s*/)
233
233
  end
234
234
 
235
- def boolean_value(name, default_value)
236
- parse_boolean_value(self[name], default_value)
235
+ def boolean_value(name, **keyword_args)
236
+ parse_boolean_value(self[name], **keyword_args)
237
237
  end
238
238
 
239
- def parse_boolean_value(value, default_value)
240
- return default_value if value.nil?
239
+ def parse_boolean_value(value, default:, invalid:)
240
+ return default if value.nil?
241
241
  value = value.strip
242
- return default_value if value.empty?
243
- value == "yes"
242
+ return default if value.empty?
243
+ case value
244
+ when "yes"
245
+ true
246
+ when "no"
247
+ false
248
+ else
249
+ invalid
250
+ end
244
251
  end
245
252
  end
246
253
  end
@@ -47,7 +47,9 @@ module Groonga
47
47
  #
48
48
  # @since 1.3.4
49
49
  def sort_hash_table?
50
- boolean_value(:sort_hash_table, false)
50
+ boolean_value(:sort_hash_table,
51
+ default: false,
52
+ invalid: false)
51
53
  end
52
54
  end
53
55
  end
@@ -70,7 +70,9 @@ module Groonga
70
70
  #
71
71
  # @since 1.3.0
72
72
  def output_ids?
73
- boolean_value(:output_ids, false)
73
+ boolean_value(:output_ids,
74
+ default: false,
75
+ invalid: false)
74
76
  end
75
77
 
76
78
  private
@@ -1,5 +1,6 @@
1
1
  # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
2
- # Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2018-2019 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2019 Yasuhiro Horimoto <horimoto@clear-code.com>
3
4
  #
4
5
  # This library is free software; you can redistribute it and/or
5
6
  # modify it under the terms of the GNU Lesser General Public
@@ -44,6 +45,9 @@ module Groonga
44
45
  :limit,
45
46
  :filter,
46
47
  :output_columns,
48
+ :use_range_index,
49
+ :post_filter,
50
+ :sort_keys,
47
51
  ]
48
52
  end
49
53
  end
@@ -130,6 +134,30 @@ module Groonga
130
134
  def output_columns
131
135
  self[:output_columns]
132
136
  end
137
+
138
+ # @return [Boolean, nil] Whether force to use or not use range index.
139
+ # `nil` means that decided whether use range index automatically.
140
+ #
141
+ # @since 1.4.3
142
+ def use_range_index
143
+ boolean_value(:use_range_index,
144
+ default: nil,
145
+ invalid: nil)
146
+ end
147
+
148
+ # @return [String] `post_filter` parameter value.
149
+ #
150
+ # @since 1.4.3
151
+ def post_filter
152
+ self[:post_filter]
153
+ end
154
+
155
+ # @return [::Array<String>] The sort keys.
156
+ #
157
+ # @since 1.4.3
158
+ def sort_keys
159
+ parse_array_value(self[:sort_keys] || "")
160
+ end
133
161
  end
134
162
  end
135
163
  end
@@ -48,7 +48,9 @@ module Groonga
48
48
  #
49
49
  # @since 1.1.7
50
50
  def force?
51
- boolean_value(:force, false)
51
+ boolean_value(:force,
52
+ default: false,
53
+ invalid: false)
52
54
  end
53
55
  end
54
56
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  module Command
19
- VERSION = "1.4.2"
19
+ VERSION = "1.4.3"
20
20
  end
21
21
  end
@@ -1,4 +1,6 @@
1
1
  # Copyright (C) 2015 Hiroshi Hatake <hatake@clear-code.com>
2
+ # Copyright (C) 2019 Yasuhiro Horimoto <horimoto@clear-code.com>
3
+ # Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
2
4
  #
3
5
  # This library is free software; you can redistribute it and/or
4
6
  # modify it under the terms of the GNU Lesser General Public
@@ -23,17 +25,20 @@ class LogicalRangeFilterCommandTest < Test::Unit::TestCase
23
25
 
24
26
  class ConstructorTest < self
25
27
  def test_ordered_arguments
26
- logical_table = "Logs"
27
- shard_key = "timestamp",
28
- min = "2015-02-12 00:00:00"
29
- min_border = "include"
30
- max = "2015-02-13 00:00:00"
31
- max_border = "exclude"
32
- order = "ascending"
33
- offset = "10"
34
- limit = "20"
35
- filter = "value == 10"
36
- output_columns = "_key, timestamp"
28
+ logical_table = "Logs"
29
+ shard_key = "timestamp",
30
+ min = "2015-02-12 00:00:00"
31
+ min_border = "include"
32
+ max = "2015-02-13 00:00:00"
33
+ max_border = "exclude"
34
+ order = "ascending"
35
+ offset = "10"
36
+ limit = "20"
37
+ filter = "value == 10"
38
+ output_columns = "_key, timestamp"
39
+ use_range_index = "yes"
40
+ post_filter = "_score > 10"
41
+ sort_keys = "timestamp, -_score"
37
42
 
38
43
  ordered_arguments = [
39
44
  logical_table,
@@ -47,20 +52,26 @@ class LogicalRangeFilterCommandTest < Test::Unit::TestCase
47
52
  limit,
48
53
  filter,
49
54
  output_columns,
55
+ use_range_index,
56
+ post_filter,
57
+ sort_keys,
50
58
  ]
51
59
  command = logical_range_filter_command({}, ordered_arguments)
52
60
  assert_equal({
53
- :logical_table => logical_table,
54
- :shard_key => shard_key,
55
- :min => min,
56
- :min_border => min_border,
57
- :max => max,
58
- :max_border => max_border,
59
- :order => order,
60
- :offset => offset,
61
- :limit => limit,
62
- :filter => filter,
63
- :output_columns => output_columns,
61
+ :logical_table => logical_table,
62
+ :shard_key => shard_key,
63
+ :min => min,
64
+ :min_border => min_border,
65
+ :max => max,
66
+ :max_border => max_border,
67
+ :order => order,
68
+ :offset => offset,
69
+ :limit => limit,
70
+ :filter => filter,
71
+ :output_columns => output_columns,
72
+ :use_range_index => use_range_index,
73
+ :post_filter => post_filter,
74
+ :sort_keys => sort_keys,
64
75
  },
65
76
  command.arguments)
66
77
  end
@@ -135,4 +146,40 @@ class LogicalRangeFilterCommandTest < Test::Unit::TestCase
135
146
  assert_equal("_key, timestamp", command.output_columns)
136
147
  end
137
148
  end
149
+
150
+ class UseRangeIndexTest < self
151
+ def test_yes
152
+ command = logical_range_filter_command(:use_range_index => "yes")
153
+ assert_true(command.use_range_index)
154
+ end
155
+
156
+ def test_no
157
+ command = logical_range_filter_command(:use_range_index => "no")
158
+ assert_false(command.use_range_index)
159
+ end
160
+
161
+ def test_default
162
+ command = logical_range_filter_command
163
+ assert_nil(command.use_range_index)
164
+ end
165
+
166
+ def test_invalid
167
+ command = logical_range_filter_command(:use_range_index => "invalid")
168
+ assert_nil(command.use_range_index)
169
+ end
170
+ end
171
+
172
+ class PostFilterTest < self
173
+ def test_reader
174
+ command = logical_range_filter_command(:post_filter => "_score > 10")
175
+ assert_equal("_score > 10", command.post_filter)
176
+ end
177
+ end
178
+
179
+ class SortKeysTest < self
180
+ def test_reader
181
+ command = logical_range_filter_command(:sort_keys => "timestamp, -_score")
182
+ assert_equal(["timestamp", "-_score"], command.sort_keys)
183
+ end
184
+ end
138
185
  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.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-21 00:00:00.000000000 Z
11
+ date: 2019-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -271,65 +271,66 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
- rubygems_version: 3.0.3
274
+ rubyforge_project:
275
+ rubygems_version: 2.7.6.2
275
276
  signing_key:
276
277
  specification_version: 4
277
278
  summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
278
279
  command. You can write a program that handle Groonga's command by using groonga-command.
279
280
  test_files:
280
281
  - test/run-test.rb
281
- - test/command/test-logical-table-remove.rb
282
- - test/command/test-reindex.rb
282
+ - test/command/test-range-filter.rb
283
283
  - test/command/test-column-rename.rb
284
- - test/command/test-query-log-flags-set.rb
285
- - test/command/test-normalize.rb
286
- - test/command/test-request-cancel.rb
284
+ - test/command/test-object-exist.rb
285
+ - test/command/test-config-get.rb
286
+ - test/command/test-table-create.rb
287
+ - test/command/test-plugin-register.rb
288
+ - test/command/test-query-log-flags-remove.rb
289
+ - test/command/format/test-command.rb
290
+ - test/command/test-table-rename.rb
291
+ - test/command/test-truncate.rb
292
+ - test/command/test-log-put.rb
287
293
  - test/command/test-query-log-flags-get.rb
288
- - test/command/test-range-filter.rb
289
- - test/command/test-log-level.rb
290
- - test/command/test-table-tokenize.rb
291
- - test/command/test-logical-select.rb
292
- - test/command/test-column-list.rb
293
- - test/command/test-status.rb
294
- - test/command/test-load.rb
295
- - test/command/test-table-remove.rb
296
- - test/command/test-index-column-diff.rb
297
- - test/command/test-suggest.rb
298
- - test/command/test-delete.rb
294
+ - test/command/test-query-log-flags-set.rb
299
295
  - test/command/test-logical-range-filter.rb
300
- - test/command/test-column-copy.rb
301
- - test/command/test-base.rb
302
- - test/command/test-table-create.rb
303
- - test/command/test-table-list.rb
304
- - test/command/test-select.rb
296
+ - test/command/test-column-list.rb
297
+ - test/command/test-ruby-load.rb
305
298
  - test/command/test-query-log-flags-add.rb
299
+ - test/command/test-table-copy.rb
306
300
  - test/command/test-config-delete.rb
301
+ - test/command/test-logical-select.rb
302
+ - test/command/test-tokenize.rb
303
+ - test/command/test-table-tokenize.rb
304
+ - test/command/test-request-cancel.rb
305
+ - test/command/test-column-copy.rb
306
+ - test/command/test-suggest.rb
307
+ - test/command/test-column-remove.rb
308
+ - test/command/test-object-remove.rb
309
+ - test/command/test-logical-shard-list.rb
310
+ - test/command/test-column-create.rb
307
311
  - test/command/test-get.rb
308
- - test/command/test-plugin-register.rb
309
- - test/command/test-config-get.rb
310
- - test/command/format/test-command.rb
311
- - test/command/test-shutdown.rb
312
+ - test/command/test-load.rb
313
+ - test/command/test-reindex.rb
314
+ - test/command/test-plugin-unregister.rb
312
315
  - test/command/test-io-flush.rb
316
+ - test/command/test-logical-table-remove.rb
317
+ - test/command/test-index-column-diff.rb
318
+ - test/command/test-register.rb
319
+ - test/command/test-object-inspect.rb
320
+ - test/command/test-delete.rb
313
321
  - test/command/test-query-expand.rb
314
- - test/command/test-logical-shard-list.rb
315
- - test/command/test-log-put.rb
316
- - test/command/test-query-log-flags-remove.rb
317
- - test/command/test-object-remove.rb
318
- - test/command/test-logical-count.rb
322
+ - test/command/test-table-list.rb
323
+ - test/command/test-status.rb
319
324
  - test/command/test-thread-limit.rb
320
- - test/command/test-column-remove.rb
321
- - test/command/test-table-copy.rb
322
- - test/command/test-ruby-load.rb
323
- - test/command/test-object-inspect.rb
324
- - test/command/test-plugin-unregister.rb
325
- - test/command/test-table-rename.rb
326
- - test/command/test-truncate.rb
327
- - test/command/test-tokenize.rb
328
325
  - test/command/test-config-set.rb
329
- - test/command/test-object-exist.rb
326
+ - test/command/test-log-level.rb
327
+ - test/command/test-shutdown.rb
330
328
  - test/command/test-ruby-eval.rb
331
- - test/command/test-register.rb
332
- - test/command/test-dump.rb
333
- - test/command/test-column-create.rb
334
329
  - test/command/test-schema.rb
330
+ - test/command/test-normalize.rb
331
+ - test/command/test-dump.rb
332
+ - test/command/test-base.rb
333
+ - test/command/test-logical-count.rb
334
+ - test/command/test-table-remove.rb
335
+ - test/command/test-select.rb
335
336
  - test/groonga-command-test-utils.rb