rroonga 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8f4ced83e2b9234d24a57f3e2e89bfcbf5166b2
4
+ data.tar.gz: e3a8bf46124b0a9314230d52cf3eb38cbe81cb3c
5
+ SHA512:
6
+ metadata.gz: 1c3b11dc02d8fc27255fe42bca26eb886ffccae0b8aaf32cb6aa906fd47d39acab72d663b1131a24805c6317b66706a82b86ab78d2cc5c1f4395a60e0a7050fb
7
+ data.tar.gz: d5e02e35e55f8adc5eb99931a109e3a80725bfa0fe941885fda89c863e03d6c9b2730766fa060caaf5b20cb825cae816cc7dcee8cd2205c11502e4f9fd33c264
@@ -1,5 +1,33 @@
1
1
  h1. NEWS
2
2
 
3
+ h2(#3-0-5). 3.0.5: 2013-07-29
4
+
5
+ h3. Improvements
6
+
7
+ * [dumper] supported dumping of DoubleArrayTrie
8
+ * Supported Int8/UInt8/Int16/UInt16 to Ruby conversion.
9
+ [groonga-dev,01524][Reported by Masaharu YOSHIOKA]
10
+ * Added memory pool mechanism to reduce GC easily.
11
+ Context#push_memory_pool and Context#pop_memory_pool are added.
12
+ You can close temporary table objects automatically:
13
+ <pre>
14
+ context.push_memory_pool do
15
+ # create tempoeray table objects by select, group, sort and so on...
16
+ end
17
+ # createed tempoeray table objects are closed automatically
18
+ </pre>
19
+ * Supported max int32 over Fixnum
20
+ [Reported by xtuaok]
21
+
22
+ h3. Fixes
23
+
24
+ * [dumper] fixed a bug that no column table isn't dumped.
25
+
26
+ h3. Thanks
27
+
28
+ * Masaharu YOSHIOKA
29
+ * xtuaok
30
+
3
31
  h2(#3-0-4). 3.0.4: 2013-07-04
4
32
 
5
33
  h3. Fixes
@@ -470,6 +470,8 @@ rb_grn_context_initialize (int argc, VALUE *argv, VALUE self)
470
470
  GRN_CTX_SET_ENCODING(context, encoding);
471
471
  }
472
472
 
473
+ rb_iv_set(self, "@memory_pools", rb_ary_new());
474
+
473
475
  debug("context new: %p\n", context);
474
476
 
475
477
  return Qnil;
@@ -924,6 +926,14 @@ rb_grn_context_array_reference (VALUE self, VALUE name_or_id)
924
926
  return GRNOBJECT2RVAL(Qnil, context, object, GRN_FALSE);
925
927
  }
926
928
 
929
+ void
930
+ rb_grn_context_object_created (VALUE rb_context, VALUE rb_object)
931
+ {
932
+ ID id_object_created;
933
+ CONST_ID(id_object_created, "object_created");
934
+ rb_funcall(rb_context, id_object_created, 1, rb_object);
935
+ }
936
+
927
937
  void
928
938
  rb_grn_init_context (VALUE mGrn)
929
939
  {
@@ -313,6 +313,16 @@ rb_grn_object_to_ruby_object (VALUE klass, grn_ctx *context, grn_obj *object,
313
313
  rb_object = rb_obj_alloc(klass);
314
314
  rb_grn_object_assign(klass, rb_object, rb_context, context, object);
315
315
 
316
+ switch (object->header.type) {
317
+ case GRN_TABLE_NO_KEY:
318
+ case GRN_TABLE_HASH_KEY:
319
+ case GRN_TABLE_PAT_KEY:
320
+ case GRN_TABLE_DAT_KEY:
321
+ rb_grn_context_object_created(rb_context, rb_object);
322
+ default:
323
+ break;
324
+ }
325
+
316
326
  return rb_object;
317
327
  }
318
328
 
@@ -205,6 +205,18 @@ rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
205
205
  case GRN_DB_BOOL:
206
206
  *rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
207
207
  break;
208
+ case GRN_DB_INT8:
209
+ *rb_value = INT2NUM(GRN_INT8_VALUE(bulk));
210
+ break;
211
+ case GRN_DB_UINT8:
212
+ *rb_value = UINT2NUM(GRN_UINT8_VALUE(bulk));
213
+ break;
214
+ case GRN_DB_INT16:
215
+ *rb_value = INT2NUM(GRN_INT16_VALUE(bulk));
216
+ break;
217
+ case GRN_DB_UINT16:
218
+ *rb_value = UINT2NUM(GRN_UINT16_VALUE(bulk));
219
+ break;
208
220
  case GRN_DB_INT32:
209
221
  *rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
210
222
  break;
@@ -373,9 +385,6 @@ rb_grn_bulk_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *bulk)
373
385
  rb_grn_context_text_set(context, bulk, object);
374
386
  break;
375
387
  case T_FIXNUM:
376
- grn_obj_reinit(context, bulk, GRN_DB_INT32, 0);
377
- GRN_INT32_SET(context, bulk, NUM2INT(object));
378
- break;
379
388
  case T_BIGNUM:
380
389
  {
381
390
  int64_t int64_value;
data/ext/groonga/rb-grn.h CHANGED
@@ -76,7 +76,7 @@ RB_GRN_BEGIN_DECLS
76
76
 
77
77
  #define RB_GRN_MAJOR_VERSION 3
78
78
  #define RB_GRN_MINOR_VERSION 0
79
- #define RB_GRN_MICRO_VERSION 4
79
+ #define RB_GRN_MICRO_VERSION 5
80
80
 
81
81
  #define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
82
82
 
@@ -313,6 +313,8 @@ grn_obj *rb_grn_context_get_backward_compatibility
313
313
  (grn_ctx *context,
314
314
  const char *name,
315
315
  unsigned int name_size);
316
+ void rb_grn_context_object_created (VALUE rb_context,
317
+ VALUE rb_object);
316
318
 
317
319
  const char *rb_grn_inspect (VALUE object);
318
320
  const char *rb_grn_inspect_type (unsigned char type);
@@ -17,6 +17,8 @@
17
17
 
18
18
  require "groonga/command"
19
19
 
20
+ require "groonga/memory-pool"
21
+
20
22
  module Groonga
21
23
  class Context
22
24
  # _path_ にある既存のデータベースを開く。ブロックを指定した場
@@ -190,5 +192,125 @@ module Groonga
190
192
  yield(buffer.dup, response) if block_given?
191
193
  end
192
194
  end
195
+
196
+ # Pushes a new memory pool to the context. Temporary objects that
197
+ # are created between pushing a new memory pool and popping the
198
+ # new memory pool are closed automatically when popping the new
199
+ # memory pool.
200
+ #
201
+ # It is useful for request and response style applications. These
202
+ # style applications can close temporary objects between a request
203
+ # and resopnse pair. There are some merits for closing temporary
204
+ # objects explicilty rather than closing implicitly by GC:
205
+ #
206
+ # * Less memory consumption
207
+ # * Faster
208
+ #
209
+ # The "less memory consumption" merit is caused by temporary
210
+ # objects are closed each request and response pair. The max
211
+ # memory consumption in these applications is the same as the max
212
+ # memory consumption in a request and response pair. If temporary
213
+ # objects are closed by GC, the max memory consumption in these
214
+ # applications is the same as the max memory consumption between
215
+ # the current GC and the next GC. These applications process many
216
+ # request and response pairs during two GCs.
217
+ #
218
+ # The "faster" merit is caused by reducing GC. You can reduce GC,
219
+ # your application run faster because GC is a heavy process. You
220
+ # can reduce GC because memory consumption is reduced.
221
+ #
222
+ # You can nest {#push_memory_pool} and {#pop_memory_pool} pair.
223
+ #
224
+ # @example Pushes a new memory pool with block
225
+ # adults = nil
226
+ # context.push_memory_pool do
227
+ # users = context["Users"]
228
+ # adults = users.select do |user|
229
+ # user.age >= 20
230
+ # end
231
+ # p adults.temporary? # => true
232
+ # p adults.closed? # => false
233
+ # end
234
+ # p adults.closed? # => true
235
+ #
236
+ # @example Pushes a new memory pool without block
237
+ # adults = nil
238
+ # context.push_memory_pool
239
+ # users = context["Users"]
240
+ # adults = users.select do |user|
241
+ # user.age >= 20
242
+ # end
243
+ # p adults.temporary? # => true
244
+ # p adults.closed? # => false
245
+ # context.pop_memory_pool
246
+ # p adults.closed? # => true
247
+ #
248
+ # @example Nesting push and pop pair
249
+ # adults = nil
250
+ # context.push_memory_pool do
251
+ # users = context["Users"]
252
+ # adults = users.select do |user|
253
+ # user.age >= 20
254
+ # end
255
+ # grouped_adults = nil
256
+ # context.push_memory_pool do
257
+ # grouped_adults = adults.group(["hobby"])
258
+ # p grouped_adults.temporary? # => true
259
+ # p grouped_adults.closed? # => false
260
+ # end
261
+ # p grouped_adults.closed? # => true
262
+ # p adults.temporary? # => true
263
+ # p adults.closed? # => false
264
+ # end
265
+ # p adults.closed? # => true
266
+ #
267
+ # @overload push_memory_pool
268
+ # Pushes a new memory pool to the context. You need to pop the
269
+ # memory pool explicitly by yourself.
270
+ #
271
+ # @return [void]
272
+ #
273
+ # @overload push_memory_pool {}
274
+ # Closes temporary objects created in the given block
275
+ # automatically.
276
+ #
277
+ # @yield []
278
+ # Yields the block. Temporary objects created in the block
279
+ # are closed automatically when the block is exited.
280
+ # @yieldreturn [Object] It is the return value of this
281
+ # method call.
282
+ # @return [Object] The value returned by the block.
283
+ #
284
+ # @since 3.0.5
285
+ def push_memory_pool
286
+ memory_pool = MemoryPool.new
287
+ @memory_pools.push(memory_pool)
288
+ return unless block_given?
289
+
290
+ begin
291
+ yield
292
+ ensure
293
+ pop_memory_pool
294
+ end
295
+ end
296
+
297
+ # Pops the pushed memory pool.
298
+ #
299
+ # @return [void]
300
+ #
301
+ # @see push_memory_pool
302
+ #
303
+ # @since 3.0.5
304
+ def pop_memory_pool
305
+ memory_pool = @memory_pools.pop
306
+ memory_pool.close
307
+ end
308
+
309
+ # @api private
310
+ def object_created(object)
311
+ return if @memory_pools.empty?
312
+ memory_pool = @memory_pools.last
313
+ memory_pool.register(object)
314
+ end
193
315
  end
194
316
  end
@@ -123,6 +123,7 @@ module Groonga
123
123
  end
124
124
 
125
125
  def index_only_table?(table)
126
+ return false if table.columns.empty?
126
127
  table.columns.all? do |column|
127
128
  column.index?
128
129
  end
@@ -414,6 +415,8 @@ module Groonga
414
415
  parameters << ":type => :hash"
415
416
  when Groonga::PatriciaTrie
416
417
  parameters << ":type => :patricia_trie"
418
+ when Groonga::DoubleArrayTrie
419
+ parameters << ":type => :double_array_trie"
417
420
  end
418
421
  if table.domain
419
422
  parameters << ":key_type => #{table.domain.name.dump}"
@@ -547,6 +550,8 @@ module Groonga
547
550
  flags << "TABLE_HASH_KEY"
548
551
  when Groonga::PatriciaTrie
549
552
  flags << "TABLE_PAT_KEY"
553
+ when Groonga::DoubleArrayTrie
554
+ flags << "TABLE_DAT_KEY"
550
555
  end
551
556
  if table.domain
552
557
  flags << "KEY_NORMALIZE" if default_normalizer?(_normalizer_name)
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ module Groonga
19
+ # @api private
20
+ class MemoryPool
21
+ def initialize
22
+ @temporary_objects = {}
23
+ end
24
+
25
+ def register(object)
26
+ return unless object.temporary?
27
+ return unless object.is_a?(Groonga::Table)
28
+ @temporary_objects[object] = true
29
+ end
30
+
31
+ def close
32
+ @temporary_objects.each do |(object, _)|
33
+ object.close unless object.closed?
34
+ end
35
+ @temporary_objects.clear
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,52 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ class ConvertTest < Test::Unit::TestCase
19
+ include GroongaTestUtils
20
+
21
+ setup :setup_database
22
+
23
+ setup
24
+ def setup_schema
25
+ end
26
+
27
+ setup
28
+ def setup_data
29
+ end
30
+
31
+ class Int64Test < self
32
+ def setup_schema
33
+ Groonga::Schema.define do |schema|
34
+ schema.create_table("Values") do |table|
35
+ table.int64("content")
36
+ end
37
+ end
38
+ @values = Groonga["Values"]
39
+ end
40
+
41
+ data("Fixnum" => -1,
42
+ "Max Fixnum" => 2 ** 62 - 1,
43
+ "Bignum" => 2 ** 62)
44
+ def test_select(value)
45
+ @values.add(:content => value)
46
+ result = @values.select do |record|
47
+ record.content == value
48
+ end
49
+ assert_equal([value], result.collect(&:content))
50
+ end
51
+ end
52
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2011-2013 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
@@ -64,6 +64,10 @@ class DatabaseDumperTest < Test::Unit::TestCase
64
64
  context["Posts"]
65
65
  end
66
66
 
67
+ def users
68
+ context["Users"]
69
+ end
70
+
67
71
  def dumped_schema
68
72
  <<-EOS
69
73
  #{dumped_schema_tables}
@@ -338,4 +342,34 @@ column_create Tags Posts_tag_text COLUMN_INDEX Posts tag_text
338
342
  COMMAND
339
343
  end
340
344
  end
345
+
346
+ class NoColumnTest < self
347
+ def setup_tables
348
+ Groonga::Schema.define do |schema|
349
+ schema.create_table("Users",
350
+ :type => :patricia_trie,
351
+ :key_type => "ShortText") do |table|
352
+ end
353
+ end
354
+ end
355
+
356
+ setup
357
+ def setup_data
358
+ users.add("s-yata")
359
+ users.add("mori")
360
+ end
361
+
362
+ def test_have_records
363
+ assert_equal(<<-EOS, dump)
364
+ table_create Users TABLE_PAT_KEY --key_type ShortText
365
+
366
+ load --table Users
367
+ [
368
+ [\"_key\"],
369
+ [\"mori\"],
370
+ [\"s-yata\"]
371
+ ]
372
+ EOS
373
+ end
374
+ end
341
375
  end
@@ -0,0 +1,88 @@
1
+ # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
+
16
+ class MemoryPoolTest < Test::Unit::TestCase
17
+ include GroongaTestUtils
18
+
19
+ def setup
20
+ setup_sandbox
21
+ setup_database
22
+ setup_schema
23
+ setup_data
24
+ end
25
+
26
+ def setup_schema
27
+ Groonga::Schema.define do |schema|
28
+ schema.create_table("Users",
29
+ :type => :hash,
30
+ :key_type => :short_text) do |table|
31
+ table.uint8(:age)
32
+ table.short_text(:hobby)
33
+ end
34
+ end
35
+ @users = context["Users"]
36
+ end
37
+
38
+ def setup_data
39
+ @users.add("mori", :age => 46, :hobby => "violin")
40
+ @users.add("s-yata", :age => 28, :hobby => "programming")
41
+ @users.add("kou", :age => 31, :hobby => "programming")
42
+ end
43
+
44
+ def teardown
45
+ teardown_sandbox
46
+ end
47
+
48
+ def test_block
49
+ adults = nil
50
+ context.push_memory_pool do
51
+ adults = @users.select do |user|
52
+ user.age >= 20
53
+ end
54
+ assert_true(adults.temporary?)
55
+ assert_false(adults.closed?)
56
+ end
57
+ assert_true(adults.closed?)
58
+ end
59
+
60
+ def test_not_block
61
+ context.push_memory_pool
62
+ adults = @users.select do |user|
63
+ user.age >= 20
64
+ end
65
+ assert_true(adults.temporary?)
66
+ assert_false(adults.closed?)
67
+ context.pop_memory_pool
68
+ assert_true(adults.closed?)
69
+ end
70
+
71
+ def test_nested
72
+ adults = nil
73
+ context.push_memory_pool do
74
+ adults = @users.select do |user|
75
+ user.age >= 20
76
+ end
77
+ grouped_adults = nil
78
+ context.push_memory_pool do
79
+ grouped_adults = adults.group(["hobby"])
80
+ assert_true(grouped_adults.temporary?)
81
+ assert_false(grouped_adults.closed?)
82
+ end
83
+ assert_true(grouped_adults.closed?)
84
+ assert_false(adults.closed?)
85
+ end
86
+ assert_true(adults.closed?)
87
+ end
88
+ end
@@ -104,21 +104,31 @@ class SchemaDumperTest < Test::Unit::TestCase
104
104
  end
105
105
  end
106
106
 
107
+ def define_double_array_trie_schema
108
+ Groonga::Schema.define do |schema|
109
+ schema.create_table("Accounts",
110
+ :type => :double_array_trie,
111
+ :key_type => "ShortText") do |table|
112
+ table.short_text("name")
113
+ end
114
+ end
115
+ end
116
+
107
117
  class RubySyntaxSchemaDumperTest < SchemaDumperTest
108
118
  def test_simple
109
119
  define_simple_schema
110
- assert_equal(<<-EOS, dump)
120
+ assert_equal(<<-SCHEMA, dump)
111
121
  create_table("Posts",
112
122
  :force => true) do |table|
113
123
  table.short_text("comments", :type => :vector)
114
124
  table.short_text("title")
115
125
  end
116
- EOS
126
+ SCHEMA
117
127
  end
118
128
 
119
129
  def test_built_in_types
120
130
  define_built_in_types_schema
121
- assert_equal(<<-EOS, dump)
131
+ assert_equal(<<-SCHEMA, dump)
122
132
  create_table("Posts",
123
133
  :force => true) do |table|
124
134
  table.long_text("attachment")
@@ -138,12 +148,12 @@ create_table("Posts",
138
148
  table.unsigned_integer8("uint8")
139
149
  table.float("vote_average")
140
150
  end
141
- EOS
151
+ SCHEMA
142
152
  end
143
153
 
144
154
  def test_reference_table
145
155
  define_reference_table_schema
146
- assert_equal(<<-EOS, dump)
156
+ assert_equal(<<-SCHEMA, dump)
147
157
  create_table("Terms",
148
158
  :type => :hash,
149
159
  :key_type => "ShortText",
@@ -155,12 +165,12 @@ create_table("IndexTerms",
155
165
  :key_type => "Terms",
156
166
  :force => true) do |table|
157
167
  end
158
- EOS
168
+ SCHEMA
159
169
  end
160
170
 
161
171
  def test_reference_column
162
172
  define_reference_column_schema
163
- assert_equal(<<-EOS, dump)
173
+ assert_equal(<<-SCHEMA, dump)
164
174
  create_table("Comments",
165
175
  :force => true) do |table|
166
176
  table.text("content")
@@ -182,12 +192,12 @@ change_table("Comments") do |table|
182
192
  table.reference("children", "Items", :type => :vector)
183
193
  table.reference("item", "Items")
184
194
  end
185
- EOS
195
+ SCHEMA
186
196
  end
187
197
 
188
198
  def test_index
189
199
  define_index_schema
190
- assert_equal(<<-EOS, dump)
200
+ assert_equal(<<-SCHEMA, dump)
191
201
  create_table("Items",
192
202
  :type => :hash,
193
203
  :key_type => "ShortText",
@@ -207,7 +217,19 @@ change_table("Terms") do |table|
207
217
  table.index("Items", "_key", :name => "Items__key")
208
218
  table.index("Items", "title", :name => "Items_title")
209
219
  end
210
- EOS
220
+ SCHEMA
221
+ end
222
+
223
+ def test_double_array_trie
224
+ define_double_array_trie_schema
225
+ assert_equal(<<-SCHEMA, dump)
226
+ create_table("Accounts",
227
+ :type => :double_array_trie,
228
+ :key_type => "ShortText",
229
+ :force => true) do |table|
230
+ table.short_text("name")
231
+ end
232
+ SCHEMA
211
233
  end
212
234
 
213
235
  private
@@ -219,25 +241,25 @@ EOS
219
241
  class CommandSyntaxSchemaDumperTest < SchemaDumperTest
220
242
  def test_simple
221
243
  define_simple_schema
222
- assert_equal(<<-EOS, dump)
244
+ assert_equal(<<-SCHEMA, dump)
223
245
  table_create Posts TABLE_NO_KEY
224
246
  column_create Posts comments COLUMN_VECTOR ShortText
225
247
  column_create Posts title COLUMN_SCALAR ShortText
226
- EOS
248
+ SCHEMA
227
249
  end
228
250
 
229
251
  def test_reference_table
230
252
  define_reference_table_schema
231
- assert_equal(<<-EOS, dump)
253
+ assert_equal(<<-SCHEMA, dump)
232
254
  table_create Terms TABLE_HASH_KEY --key_type ShortText
233
255
 
234
256
  table_create IndexTerms TABLE_HASH_KEY --key_type Terms
235
- EOS
257
+ SCHEMA
236
258
  end
237
259
 
238
260
  def test_reference_column
239
261
  define_reference_column_schema
240
- assert_equal(<<-EOS, dump)
262
+ assert_equal(<<-SCHEMA, dump)
241
263
  table_create Comments TABLE_NO_KEY
242
264
  column_create Comments content COLUMN_SCALAR Text
243
265
  column_create Comments issued COLUMN_SCALAR Time
@@ -251,12 +273,12 @@ column_create Users name COLUMN_SCALAR ShortText
251
273
  column_create Comments author COLUMN_SCALAR Users
252
274
  column_create Comments children COLUMN_VECTOR Items
253
275
  column_create Comments item COLUMN_SCALAR Items
254
- EOS
276
+ SCHEMA
255
277
  end
256
278
 
257
279
  def test_index
258
280
  define_index_schema
259
- assert_equal(<<-EOS, dump)
281
+ assert_equal(<<-SCHEMA, dump)
260
282
  table_create Items TABLE_HASH_KEY --key_type ShortText
261
283
  column_create Items title COLUMN_SCALAR ShortText
262
284
 
@@ -264,7 +286,15 @@ table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_to
264
286
 
265
287
  column_create Terms Items__key COLUMN_INDEX|WITH_POSITION Items _key
266
288
  column_create Terms Items_title COLUMN_INDEX|WITH_POSITION Items title
267
- EOS
289
+ SCHEMA
290
+ end
291
+
292
+ def test_double_array_trie
293
+ define_double_array_trie_schema
294
+ assert_equal(<<-SCHEMA, dump)
295
+ table_create Accounts TABLE_DAT_KEY --key_type ShortText
296
+ column_create Accounts name COLUMN_SCALAR ShortText
297
+ SCHEMA
268
298
  end
269
299
 
270
300
  private
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rroonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
5
- prerelease:
4
+ version: 3.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kouhei Sutou
@@ -13,191 +12,167 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2013-07-04 00:00:00.000000000 Z
15
+ date: 2013-07-29 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: pkg-config
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
- - - ! '>='
21
+ - - '>='
24
22
  - !ruby/object:Gem::Version
25
23
  version: '0'
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - '>='
32
29
  - !ruby/object:Gem::Version
33
30
  version: '0'
34
31
  - !ruby/object:Gem::Dependency
35
32
  name: json
36
33
  requirement: !ruby/object:Gem::Requirement
37
- none: false
38
34
  requirements:
39
- - - ! '>='
35
+ - - '>='
40
36
  - !ruby/object:Gem::Version
41
37
  version: '0'
42
38
  type: :runtime
43
39
  prerelease: false
44
40
  version_requirements: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
- - - ! '>='
42
+ - - '>='
48
43
  - !ruby/object:Gem::Version
49
44
  version: '0'
50
45
  - !ruby/object:Gem::Dependency
51
46
  name: archive-zip
52
47
  requirement: !ruby/object:Gem::Requirement
53
- none: false
54
48
  requirements:
55
- - - ! '>='
49
+ - - '>='
56
50
  - !ruby/object:Gem::Version
57
51
  version: '0'
58
52
  type: :runtime
59
53
  prerelease: false
60
54
  version_requirements: !ruby/object:Gem::Requirement
61
- none: false
62
55
  requirements:
63
- - - ! '>='
56
+ - - '>='
64
57
  - !ruby/object:Gem::Version
65
58
  version: '0'
66
59
  - !ruby/object:Gem::Dependency
67
60
  name: test-unit
68
61
  requirement: !ruby/object:Gem::Requirement
69
- none: false
70
62
  requirements:
71
- - - ! '>='
63
+ - - '>='
72
64
  - !ruby/object:Gem::Version
73
65
  version: 2.4.6
74
66
  type: :development
75
67
  prerelease: false
76
68
  version_requirements: !ruby/object:Gem::Requirement
77
- none: false
78
69
  requirements:
79
- - - ! '>='
70
+ - - '>='
80
71
  - !ruby/object:Gem::Version
81
72
  version: 2.4.6
82
73
  - !ruby/object:Gem::Dependency
83
74
  name: test-unit-notify
84
75
  requirement: !ruby/object:Gem::Requirement
85
- none: false
86
76
  requirements:
87
- - - ! '>='
77
+ - - '>='
88
78
  - !ruby/object:Gem::Version
89
79
  version: '0'
90
80
  type: :development
91
81
  prerelease: false
92
82
  version_requirements: !ruby/object:Gem::Requirement
93
- none: false
94
83
  requirements:
95
- - - ! '>='
84
+ - - '>='
96
85
  - !ruby/object:Gem::Version
97
86
  version: '0'
98
87
  - !ruby/object:Gem::Dependency
99
88
  name: rake
100
89
  requirement: !ruby/object:Gem::Requirement
101
- none: false
102
90
  requirements:
103
- - - ! '>='
91
+ - - '>='
104
92
  - !ruby/object:Gem::Version
105
93
  version: '0'
106
94
  type: :development
107
95
  prerelease: false
108
96
  version_requirements: !ruby/object:Gem::Requirement
109
- none: false
110
97
  requirements:
111
- - - ! '>='
98
+ - - '>='
112
99
  - !ruby/object:Gem::Version
113
100
  version: '0'
114
101
  - !ruby/object:Gem::Dependency
115
102
  name: rake-compiler
116
103
  requirement: !ruby/object:Gem::Requirement
117
- none: false
118
104
  requirements:
119
- - - ! '>='
105
+ - - '>='
120
106
  - !ruby/object:Gem::Version
121
107
  version: '0'
122
108
  type: :development
123
109
  prerelease: false
124
110
  version_requirements: !ruby/object:Gem::Requirement
125
- none: false
126
111
  requirements:
127
- - - ! '>='
112
+ - - '>='
128
113
  - !ruby/object:Gem::Version
129
114
  version: '0'
130
115
  - !ruby/object:Gem::Dependency
131
116
  name: bundler
132
117
  requirement: !ruby/object:Gem::Requirement
133
- none: false
134
118
  requirements:
135
- - - ! '>='
119
+ - - '>='
136
120
  - !ruby/object:Gem::Version
137
121
  version: '0'
138
122
  type: :development
139
123
  prerelease: false
140
124
  version_requirements: !ruby/object:Gem::Requirement
141
- none: false
142
125
  requirements:
143
- - - ! '>='
126
+ - - '>='
144
127
  - !ruby/object:Gem::Version
145
128
  version: '0'
146
129
  - !ruby/object:Gem::Dependency
147
130
  name: yard
148
131
  requirement: !ruby/object:Gem::Requirement
149
- none: false
150
132
  requirements:
151
- - - ! '>='
133
+ - - '>='
152
134
  - !ruby/object:Gem::Version
153
135
  version: '0'
154
136
  type: :development
155
137
  prerelease: false
156
138
  version_requirements: !ruby/object:Gem::Requirement
157
- none: false
158
139
  requirements:
159
- - - ! '>='
140
+ - - '>='
160
141
  - !ruby/object:Gem::Version
161
142
  version: '0'
162
143
  - !ruby/object:Gem::Dependency
163
144
  name: packnga
164
145
  requirement: !ruby/object:Gem::Requirement
165
- none: false
166
146
  requirements:
167
- - - ! '>='
147
+ - - '>='
168
148
  - !ruby/object:Gem::Version
169
149
  version: 0.9.7
170
150
  type: :development
171
151
  prerelease: false
172
152
  version_requirements: !ruby/object:Gem::Requirement
173
- none: false
174
153
  requirements:
175
- - - ! '>='
154
+ - - '>='
176
155
  - !ruby/object:Gem::Version
177
156
  version: 0.9.7
178
157
  - !ruby/object:Gem::Dependency
179
158
  name: RedCloth
180
159
  requirement: !ruby/object:Gem::Requirement
181
- none: false
182
160
  requirements:
183
- - - ! '>='
161
+ - - '>='
184
162
  - !ruby/object:Gem::Version
185
163
  version: '0'
186
164
  type: :development
187
165
  prerelease: false
188
166
  version_requirements: !ruby/object:Gem::Requirement
189
- none: false
190
167
  requirements:
191
- - - ! '>='
168
+ - - '>='
192
169
  - !ruby/object:Gem::Version
193
170
  version: '0'
194
- description: ! 'rroonga is an extension library to use groonga''s DB-API
195
-
171
+ description: |-
172
+ rroonga is an extension library to use groonga's DB-API
196
173
  layer. rroonga provides Rubyish readable and writable API
197
-
198
- not C like API. You can use groonga''s fast and highly
199
-
200
- functional features from Ruby with Rubyish form.'
174
+ not C like API. You can use groonga's fast and highly
175
+ functional features from Ruby with Rubyish form.
201
176
  email:
202
177
  - kou@clear-code.com
203
178
  - a@razil.jp
@@ -205,9 +180,9 @@ email:
205
180
  - y.hayamizu@gmail.com
206
181
  - dara@shidara.net
207
182
  executables:
208
- - groonga-index-dump
209
- - grntest-log-analyze
210
183
  - grndump
184
+ - grntest-log-analyze
185
+ - groonga-index-dump
211
186
  extensions:
212
187
  - ext/groonga/extconf.rb
213
188
  extra_rdoc_files:
@@ -218,201 +193,205 @@ files:
218
193
  - rroonga.gemspec
219
194
  - rroonga-build.rb
220
195
  - extconf.rb
196
+ - lib/groonga/dumper.rb
197
+ - lib/groonga/posting.rb
198
+ - lib/groonga/record.rb
199
+ - lib/groonga/sub-records.rb
200
+ - lib/groonga/patricia-trie.rb
201
+ - lib/groonga/expression-builder.rb
221
202
  - lib/groonga/schema.rb
222
- - lib/groonga/database.rb
223
- - lib/groonga/geo-point.rb
203
+ - lib/groonga/memory-pool.rb
224
204
  - lib/groonga/expression-builder-19.rb
225
- - lib/groonga/sub-records.rb
226
- - lib/groonga/pagination.rb
227
- - lib/groonga/index-column.rb
228
205
  - lib/groonga/view-record.rb
229
- - lib/groonga/patricia-trie.rb
230
- - lib/groonga/grntest-log.rb
231
206
  - lib/groonga/command.rb
232
- - lib/groonga/dumper.rb
233
- - lib/groonga/posting.rb
234
- - lib/groonga/query-logger.rb
235
207
  - lib/groonga/context.rb
236
- - lib/groonga/record.rb
237
- - lib/groonga/expression-builder.rb
208
+ - lib/groonga/database.rb
209
+ - lib/groonga/query-logger.rb
210
+ - lib/groonga/pagination.rb
211
+ - lib/groonga/index-column.rb
212
+ - lib/groonga/grntest-log.rb
213
+ - lib/groonga/geo-point.rb
238
214
  - lib/groonga/logger.rb
239
215
  - lib/groonga.rb
216
+ - benchmark/write-many-small-items.rb
240
217
  - benchmark/common.rb
241
- - benchmark/repeat-load.rb
242
- - benchmark/read-write-many-small-items.rb
243
218
  - benchmark/create-wikipedia-database.rb
244
- - benchmark/write-many-small-items.rb
219
+ - benchmark/repeat-load.rb
245
220
  - benchmark/select.rb
221
+ - benchmark/read-write-many-small-items.rb
246
222
  - misc/grnop2ruby.rb
247
223
  - example/index-html.rb
248
224
  - example/bookmark.rb
249
- - ext/groonga/rb-grn-procedure.c
250
- - ext/groonga/rb-grn-column.c
251
- - ext/groonga/rb-grn-index-column.c
225
+ - ext/groonga/rb-grn-type.c
226
+ - ext/groonga/rb-grn-context.c
227
+ - ext/groonga/rb-grn-geo-point.c
228
+ - ext/groonga/rb-grn-table-cursor.c
252
229
  - ext/groonga/rb-grn-encoding-support.c
253
- - ext/groonga/rb-grn-variable.c
254
- - ext/groonga/rb-grn-table.c
230
+ - ext/groonga/rb-grn-normalizer.c
231
+ - ext/groonga/rb-grn-plugin.c
232
+ - ext/groonga/rb-grn-column.c
233
+ - ext/groonga/rb-grn-patricia-trie.c
234
+ - ext/groonga/rb-grn-hash.c
255
235
  - ext/groonga/rb-grn-hash-cursor.c
256
- - ext/groonga/rb-grn-table-cursor-key-support.c
257
- - ext/groonga/rb-grn-object.c
258
- - ext/groonga/rb-grn-double-array-trie.c
259
- - ext/groonga/rb-grn-table-key-support.c
236
+ - ext/groonga/rb-grn-database.c
260
237
  - ext/groonga/rb-grn-array.c
261
- - ext/groonga/rb-grn-patricia-trie.c
262
- - ext/groonga/rb-grn-double-array-trie-cursor.c
263
- - ext/groonga/rb-grn-utils.c
238
+ - ext/groonga/rb-grn-fix-size-column.c
264
239
  - ext/groonga/rb-grn-record.c
265
- - ext/groonga/rb-grn-normalizer.c
240
+ - ext/groonga/rb-grn-index-cursor.c
241
+ - ext/groonga/rb-grn-variable.c
242
+ - ext/groonga/rb-grn-logger.c
243
+ - ext/groonga/rb-grn-expression.c
266
244
  - ext/groonga/rb-groonga.c
267
- - ext/groonga/rb-grn-exception.c
268
- - ext/groonga/rb-grn-variable-size-column.c
269
- - ext/groonga/rb-grn-encoding.c
270
- - ext/groonga/rb-grn-geo-point.c
271
245
  - ext/groonga/rb-grn-expression-builder.c
272
- - ext/groonga/rb-grn-operator.c
273
- - ext/groonga/rb-grn-snippet.c
274
- - ext/groonga/rb-grn-array-cursor.c
275
- - ext/groonga/rb-grn-type.c
276
- - ext/groonga/rb-grn-table-cursor.c
277
- - ext/groonga/rb-grn-fix-size-column.c
278
- - ext/groonga/rb-grn-logger.c
279
- - ext/groonga/rb-grn-plugin.c
280
- - ext/groonga/rb-grn-database.c
281
- - ext/groonga/rb-grn-patricia-trie-cursor.c
282
- - ext/groonga/rb-grn-index-cursor.c
246
+ - ext/groonga/rb-grn-procedure.c
247
+ - ext/groonga/rb-grn-encoding.c
248
+ - ext/groonga/rb-grn-object.c
249
+ - ext/groonga/rb-grn-index-column.c
250
+ - ext/groonga/rb-grn-double-array-trie.c
283
251
  - ext/groonga/rb-grn-accessor.c
284
- - ext/groonga/rb-grn-context.c
285
- - ext/groonga/rb-grn-query-logger.c
252
+ - ext/groonga/rb-grn-table-cursor-key-support.c
286
253
  - ext/groonga/rb-grn-posting.c
287
- - ext/groonga/rb-grn-expression.c
288
- - ext/groonga/rb-grn-hash.c
254
+ - ext/groonga/rb-grn-exception.c
255
+ - ext/groonga/rb-grn-query-logger.c
256
+ - ext/groonga/rb-grn-table-key-support.c
257
+ - ext/groonga/rb-grn-table.c
258
+ - ext/groonga/rb-grn-utils.c
259
+ - ext/groonga/rb-grn-array-cursor.c
260
+ - ext/groonga/rb-grn-snippet.c
261
+ - ext/groonga/rb-grn-operator.c
262
+ - ext/groonga/rb-grn-variable-size-column.c
263
+ - ext/groonga/rb-grn-double-array-trie-cursor.c
264
+ - ext/groonga/rb-grn-patricia-trie-cursor.c
289
265
  - ext/groonga/rb-grn.h
290
266
  - ext/groonga/extconf.rb
291
267
  - ext/groonga/groonga.def
292
268
  - README.textile
293
- - test/test-normalizer.rb
294
- - test/test-schema.rb
295
- - test/test-vector-column.rb
296
- - test/test-schema-dumper.rb
297
- - test/run-test.rb
298
- - test/test-procedure.rb
299
- - test/test-hash.rb
300
- - test/test-expression.rb
269
+ - test/groonga-test-utils.rb
270
+ - test/test-table-select-normalize.rb
271
+ - test/test-record.rb
272
+ - test/test-database.rb
301
273
  - test/test-version.rb
274
+ - test/test-convert.rb
302
275
  - test/test-remote.rb
303
- - test/test-table-offset-and-limit.rb
304
- - test/test-expression-builder.rb
305
276
  - test/test-sub-records.rb
277
+ - test/test-plugin.rb
278
+ - test/test-schema-type.rb
279
+ - test/test-table-offset-and-limit.rb
280
+ - test/test-command-select.rb
281
+ - test/test-expression.rb
306
282
  - test/test-encoding.rb
307
- - test/test-snippet.rb
308
- - test/test-index-cursor.rb
309
- - test/test-type.rb
310
- - test/test-table-dumper.rb
311
- - test/test-table-traverse.rb
312
- - test/test-table.rb
313
- - test/test-pagination.rb
314
- - test/groonga-test-utils.rb
315
- - test/test-logger.rb
316
- - test/test-context.rb
317
- - test/test-table-select-weight.rb
283
+ - test/test-schema.rb
284
+ - test/test-variable-size-column.rb
318
285
  - test/test-exception.rb
319
- - test/test-table-select-normalize.rb
320
- - test/test-command-select.rb
286
+ - test/test-double-array-trie.rb
287
+ - test/test-accessor.rb
288
+ - test/run-test.rb
289
+ - test/test-context.rb
290
+ - test/test-table-select-mecab.rb
291
+ - test/test-schema-create-table.rb
292
+ - test/test-table-select.rb
293
+ - test/test-hash.rb
294
+ - test/test-table-traverse.rb
295
+ - test/test-table-dumper.rb
321
296
  - test/test-gqtp.rb
322
- - test/test-database-dumper.rb
323
- - test/test-index-column.rb
297
+ - test/test-patricia-trie.rb
298
+ - test/test-normalizer.rb
324
299
  - test/test-geo-point.rb
325
- - test/test-plugin.rb
326
- - test/test-variable-size-column.rb
327
- - test/test-schema-create-table.rb
300
+ - test/test-type.rb
301
+ - test/test-table.rb
302
+ - test/test-vector-column.rb
303
+ - test/test-index-cursor.rb
328
304
  - test/test-array.rb
305
+ - test/test-procedure.rb
306
+ - test/test-schema-dumper.rb
329
307
  - test/test-fix-size-column.rb
330
- - test/test-schema-type.rb
331
- - test/test-table-select.rb
332
- - test/test-variable.rb
333
308
  - test/test-column.rb
334
- - test/test-patricia-trie.rb
335
- - test/test-table-select-mecab.rb
336
- - test/test-accessor.rb
337
- - test/test-database.rb
338
- - test/test-double-array-trie.rb
339
- - test/test-record.rb
340
- - bin/groonga-index-dump
341
- - bin/grntest-log-analyze
309
+ - test/test-expression-builder.rb
310
+ - test/test-index-column.rb
311
+ - test/test-database-dumper.rb
312
+ - test/test-snippet.rb
313
+ - test/test-logger.rb
314
+ - test/test-memory-pool.rb
315
+ - test/test-pagination.rb
316
+ - test/test-table-select-weight.rb
317
+ - test/test-variable.rb
342
318
  - bin/grndump
319
+ - bin/grntest-log-analyze
320
+ - bin/groonga-index-dump
343
321
  homepage: http://groonga.rubyforge.org/#about-rroonga
344
322
  licenses:
345
323
  - LGPLv2
324
+ metadata: {}
346
325
  post_install_message:
347
326
  rdoc_options: []
348
327
  require_paths:
349
328
  - lib
350
329
  - ext/groonga
351
330
  required_ruby_version: !ruby/object:Gem::Requirement
352
- none: false
353
331
  requirements:
354
- - - ! '>='
332
+ - - '>='
355
333
  - !ruby/object:Gem::Version
356
334
  version: 1.9.3
357
335
  required_rubygems_version: !ruby/object:Gem::Requirement
358
- none: false
359
336
  requirements:
360
- - - ! '>='
337
+ - - '>='
361
338
  - !ruby/object:Gem::Version
362
339
  version: '0'
363
340
  requirements: []
364
341
  rubyforge_project: groonga
365
- rubygems_version: 1.8.23
342
+ rubygems_version: 2.0.2
366
343
  signing_key:
367
- specification_version: 3
344
+ specification_version: 4
368
345
  summary: Ruby bindings for groonga that provide full text search and column store
369
346
  features.
370
347
  test_files:
371
- - test/test-normalizer.rb
372
- - test/test-schema.rb
373
- - test/test-vector-column.rb
374
- - test/test-schema-dumper.rb
375
- - test/run-test.rb
376
- - test/test-procedure.rb
377
- - test/test-hash.rb
378
- - test/test-expression.rb
348
+ - test/groonga-test-utils.rb
349
+ - test/test-table-select-normalize.rb
350
+ - test/test-record.rb
351
+ - test/test-database.rb
379
352
  - test/test-version.rb
353
+ - test/test-convert.rb
380
354
  - test/test-remote.rb
381
- - test/test-table-offset-and-limit.rb
382
- - test/test-expression-builder.rb
383
355
  - test/test-sub-records.rb
356
+ - test/test-plugin.rb
357
+ - test/test-schema-type.rb
358
+ - test/test-table-offset-and-limit.rb
359
+ - test/test-command-select.rb
360
+ - test/test-expression.rb
384
361
  - test/test-encoding.rb
385
- - test/test-snippet.rb
386
- - test/test-index-cursor.rb
387
- - test/test-type.rb
388
- - test/test-table-dumper.rb
389
- - test/test-table-traverse.rb
390
- - test/test-table.rb
391
- - test/test-pagination.rb
392
- - test/groonga-test-utils.rb
393
- - test/test-logger.rb
394
- - test/test-context.rb
395
- - test/test-table-select-weight.rb
362
+ - test/test-schema.rb
363
+ - test/test-variable-size-column.rb
396
364
  - test/test-exception.rb
397
- - test/test-table-select-normalize.rb
398
- - test/test-command-select.rb
365
+ - test/test-double-array-trie.rb
366
+ - test/test-accessor.rb
367
+ - test/run-test.rb
368
+ - test/test-context.rb
369
+ - test/test-table-select-mecab.rb
370
+ - test/test-schema-create-table.rb
371
+ - test/test-table-select.rb
372
+ - test/test-hash.rb
373
+ - test/test-table-traverse.rb
374
+ - test/test-table-dumper.rb
399
375
  - test/test-gqtp.rb
400
- - test/test-database-dumper.rb
401
- - test/test-index-column.rb
376
+ - test/test-patricia-trie.rb
377
+ - test/test-normalizer.rb
402
378
  - test/test-geo-point.rb
403
- - test/test-plugin.rb
404
- - test/test-variable-size-column.rb
405
- - test/test-schema-create-table.rb
379
+ - test/test-type.rb
380
+ - test/test-table.rb
381
+ - test/test-vector-column.rb
382
+ - test/test-index-cursor.rb
406
383
  - test/test-array.rb
384
+ - test/test-procedure.rb
385
+ - test/test-schema-dumper.rb
407
386
  - test/test-fix-size-column.rb
408
- - test/test-schema-type.rb
409
- - test/test-table-select.rb
410
- - test/test-variable.rb
411
387
  - test/test-column.rb
412
- - test/test-patricia-trie.rb
413
- - test/test-table-select-mecab.rb
414
- - test/test-accessor.rb
415
- - test/test-database.rb
416
- - test/test-double-array-trie.rb
417
- - test/test-record.rb
388
+ - test/test-expression-builder.rb
389
+ - test/test-index-column.rb
390
+ - test/test-database-dumper.rb
391
+ - test/test-snippet.rb
392
+ - test/test-logger.rb
393
+ - test/test-memory-pool.rb
394
+ - test/test-pagination.rb
395
+ - test/test-table-select-weight.rb
396
+ - test/test-variable.rb
418
397
  has_rdoc: