rroonga 5.0.2 → 5.0.3

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
  SHA1:
3
- metadata.gz: 0a3d4a6d287300f6e5850b233cdcfb23f8cb83a7
4
- data.tar.gz: d33d0d1174dca89402649b2493f25f98db74098f
3
+ metadata.gz: 269475e06e66319490d5e9140e0c7dd6c3a3ee39
4
+ data.tar.gz: 1d46c8e6ddbb842a850c12c576e857ac959a2502
5
5
  SHA512:
6
- metadata.gz: 0743960c36734c384b7918b8a43c5e76be58e7ac6a3872240ecb7ec81a357ddb27289e8129c15d6aebe635e823c98d1901cd4fdff14d0b7d0272bbc2a9f60c24
7
- data.tar.gz: c202e713749c0c39b4ee80b3afc1b49ee4e01d8464f4a56fdb1a5fa0727893a893f0660c85a038640a9a88fee9dd480e2b4ae5a253965ae8cd83143aeebfbc62
6
+ metadata.gz: fe216529739235d3b06eddc14c6dfa270baa847c529e909b7e27ef53bc5a38b85e987b62a56dee222a268bf0ddd8bc912f9c40d4a6de5fc0ad83c4e4ecff4758
7
+ data.tar.gz: 4536a87811347c1cf3b7b1acf45d2d226205f5db61720351a4e86be2d826d2b41829c8c22e4e5f94cf40fd3523272135d0b920fb2fc9e48ae5a80a2314d611fc
data/README.md CHANGED
@@ -40,7 +40,7 @@ contributed patches.)
40
40
  ## Dependencies
41
41
 
42
42
  * Ruby >= 1.9.3
43
- * Groonga >= 5.0.2
43
+ * Groonga >= 5.0.3
44
44
 
45
45
  ## Install
46
46
 
@@ -35,6 +35,11 @@ parser.on("--no-columns",
35
35
  "Don't show column information") do |boolean|
36
36
  options.show_columns = boolean
37
37
  end
38
+ parser.on("--log-path=PATH",
39
+ "Specify log path",
40
+ "(#{Groonga::Logger.path})") do |path|
41
+ Groonga::Logger.path = path
42
+ end
38
43
  args = parser.parse!(ARGV)
39
44
 
40
45
  if args.size != 1
@@ -166,7 +166,7 @@ rb_grn_logger_s_log (int argc, VALUE *argv, VALUE klass)
166
166
  VALUE rb_file;
167
167
  const char *file = NULL;
168
168
  VALUE rb_line;
169
- int line;
169
+ int line = 0;
170
170
  VALUE rb_function;
171
171
  const char *function = NULL;
172
172
  VALUE rb_options;
@@ -611,6 +611,7 @@ rb_grn_table_get_columns (int argc, VALUE *argv, VALUE self)
611
611
 
612
612
  columns = grn_table_create(context, NULL, 0, NULL, GRN_TABLE_HASH_KEY,
613
613
  NULL, 0);
614
+ rb_grn_context_check(context, self);
614
615
  n = grn_table_columns(context, table, name, name_size, columns);
615
616
  rb_grn_context_check(context, self);
616
617
 
data/ext/groonga/rb-grn.h CHANGED
@@ -101,7 +101,7 @@ RB_GRN_BEGIN_DECLS
101
101
 
102
102
  #define RB_GRN_MAJOR_VERSION 5
103
103
  #define RB_GRN_MINOR_VERSION 0
104
- #define RB_GRN_MICRO_VERSION 2
104
+ #define RB_GRN_MICRO_VERSION 3
105
105
 
106
106
  #define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
107
107
 
@@ -89,6 +89,10 @@ module Groonga
89
89
  end
90
90
 
91
91
  private
92
+ def push_memory_pool(&block)
93
+ @database.context.push_memory_pool(&block)
94
+ end
95
+
92
96
  def report_plugins
93
97
  write("Plugins:\n")
94
98
  indent do
@@ -158,6 +162,20 @@ module Groonga
158
162
  indent do
159
163
  write("ID: #{column.id}\n")
160
164
  write("Type: #{inspect_column_type(column)}\n")
165
+ if column.index?
166
+ sources = column.sources
167
+ write("N sources: #{sources.size}\n")
168
+ unless sources.empty?
169
+ write("Sources:\n")
170
+ indent do
171
+ sources.each do |source|
172
+ write("Name: #{inspect_source(source)}\n")
173
+ end
174
+ end
175
+ end
176
+ else
177
+ write("Value type: #{inspect_value_type(column.range)}\n")
178
+ end
161
179
  write("Path: #{inspect_path(column.path)}\n")
162
180
  write("Disk usage: #{inspect_sub_disk_usage(column.disk_usage)}\n")
163
181
  end
@@ -222,7 +240,9 @@ module Groonga
222
240
 
223
241
  def count_total_n_columns
224
242
  @database.tables.inject(0) do |previous, table|
225
- previous + table.columns.size
243
+ push_memory_pool do
244
+ previous + table.columns.size
245
+ end
226
246
  end
227
247
  end
228
248
 
@@ -237,8 +257,10 @@ module Groonga
237
257
  end
238
258
 
239
259
  def count_total_table_disk_usage(table)
240
- table.columns.inject(table.disk_usage) do |previous, column|
241
- previous + column.disk_usage
260
+ push_memory_pool do
261
+ table.columns.inject(table.disk_usage) do |previous, column|
262
+ previous + column.disk_usage
263
+ end
242
264
  end
243
265
  end
244
266
 
@@ -265,6 +287,14 @@ module Groonga
265
287
  end
266
288
  end
267
289
 
290
+ def inspect_value_type(range)
291
+ if range.nil?
292
+ "(no value)"
293
+ else
294
+ range.name
295
+ end
296
+ end
297
+
268
298
  def inspect_tokenizer(table)
269
299
  if table.support_key?
270
300
  tokenizer = table.default_tokenizer
@@ -300,6 +330,14 @@ module Groonga
300
330
  "scalar"
301
331
  end
302
332
  end
333
+
334
+ def inspect_source(source)
335
+ if source.is_a?(Table)
336
+ "#{source.name}._key"
337
+ else
338
+ source.name
339
+ end
340
+ end
303
341
  end
304
342
  end
305
343
  end
data/rroonga-build.rb CHANGED
@@ -22,13 +22,13 @@ module RroongaBuild
22
22
  MINOR = 0
23
23
  MICRO = 3
24
24
  VERSION = [MAJOR, MINOR, MICRO]
25
- RELEASED_DATE = Time.utc(2015, 3, 31)
25
+ RELEASED_DATE = Time.utc(2015, 4, 29)
26
26
  end
27
27
 
28
28
  module LatestGroongaVersion
29
29
  MAJOR = 5
30
30
  MINOR = 0
31
- MICRO = 3
31
+ MICRO = 4
32
32
  VERSION = [MAJOR, MINOR, MICRO]
33
33
  end
34
34
 
data/rroonga.gemspec CHANGED
@@ -78,7 +78,6 @@ Gem::Specification.new do |s|
78
78
  s.homepage = "http://ranguba.org/#about-rroonga"
79
79
  s.licenses = ["LGPL-2.1"]
80
80
  s.require_paths = ["lib", "ext/groonga"]
81
- s.rubyforge_project = "groonga"
82
81
 
83
82
  s.required_ruby_version = ">= 1.9.3"
84
83
 
@@ -144,6 +144,7 @@ class DatabaseInspectorTest < Test::Unit::TestCase
144
144
  #{column.local_name}:
145
145
  ID: #{column.id}
146
146
  Type: #{inspect_column_type(column)}
147
+ Value type: #{inspect_value_type(column.range)}
147
148
  Path: <#{column.path}>
148
149
  Disk usage: #{inspect_sub_disk_usage(column.disk_usage)}
149
150
  INSPECTED
@@ -164,6 +165,14 @@ class DatabaseInspectorTest < Test::Unit::TestCase
164
165
  end
165
166
  end
166
167
 
168
+ def inspect_value_type(range)
169
+ if range.nil?
170
+ "(no value)"
171
+ else
172
+ range.name
173
+ end
174
+ end
175
+
167
176
  class DatabaseTest < self
168
177
  def test_empty
169
178
  assert_equal(<<-INSPECTED, report)
@@ -713,10 +722,58 @@ Database
713
722
  end
714
723
 
715
724
  def inspected(type)
725
+ if type == "index"
726
+ sources = @column.sources
727
+ additional_info = " N sources: #{sources.size}\n"
728
+ additional_info << " Sources:\n"
729
+ source_names = sources.collect do |source|
730
+ " Name: #{source.name}"
731
+ end
732
+ additional_info << source_names.join("\n")
733
+ else
734
+ additional_info = " Value type: #{@column.range.name}"
735
+ end
716
736
  <<-INSPECTED
717
737
  #{@column.local_name}:
718
738
  ID: #{@column.id}
719
739
  Type: #{type}
740
+ #{additional_info}
741
+ Path: <#{@column.path}>
742
+ Disk usage: #{inspect_sub_disk_usage(@column.disk_usage)}
743
+ INSPECTED
744
+ end
745
+ end
746
+
747
+ class SourceTest < self
748
+ def test_key
749
+ Groonga::Schema.create_table("Users",
750
+ :type => :patricia_trie,
751
+ :key_type => "ShortText") do |table|
752
+ end
753
+ Groonga::Schema.create_table("Terms",
754
+ :type => :patricia_trie,
755
+ :key_type => "ShortText",
756
+ :default_tokenizer => "TokenBigram",
757
+ :normalizer => "NormalizerAuto") do |table|
758
+ table.index("Users._key")
759
+ end
760
+ @table = Groonga["Terms"]
761
+ @column = @table.columns.first
762
+ assert_equal(inspected(["Users._key"]), report)
763
+ end
764
+
765
+ private
766
+ def inspected(source_names)
767
+ inspected_sources = " N sources: #{source_names.size}\n"
768
+ inspected_sources << " Sources:\n"
769
+ source_names.each do |source_name|
770
+ inspected_sources << " Name: #{source_name}\n"
771
+ end
772
+ <<-INSPECTED
773
+ #{@column.local_name}:
774
+ ID: #{@column.id}
775
+ Type: index
776
+ #{inspected_sources.chomp}
720
777
  Path: <#{@column.path}>
721
778
  Disk usage: #{inspect_sub_disk_usage(@column.disk_usage)}
722
779
  INSPECTED
@@ -70,6 +70,8 @@ class DatabaseTest < Test::Unit::TestCase
70
70
  end
71
71
 
72
72
  def test_new
73
+ # TODO: remove the line when Groonga 5.0.5 released.
74
+ omit("This test is failing on Groonga 5.0.4.") if Groonga.version == "5.0.4"
73
75
  assert_raise(Groonga::NoSuchFileOrDirectory) do
74
76
  new_context = Groonga::Context.new
75
77
  Groonga::Database.new(@database_path.to_s, :context => new_context)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rroonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-05-18 00:00:00.000000000 Z
15
+ date: 2015-06-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  - !ruby/object:Gem::Version
379
379
  version: '0'
380
380
  requirements: []
381
- rubyforge_project: groonga
381
+ rubyforge_project:
382
382
  rubygems_version: 2.2.2
383
383
  signing_key:
384
384
  specification_version: 4