rroonga 4.0.7 → 4.0.8

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: 21a2beefeeeffe25a4ebeecbad4934aa49a64dad
4
- data.tar.gz: ff7dda3b86483ab0c6c72d46afb77e3bdb4c1205
3
+ metadata.gz: d2c33b482dafe8f399af8b7470fd96e22550930d
4
+ data.tar.gz: 6d52fe1e3cceffd71e9b1b93ce64549d0669d806
5
5
  SHA512:
6
- metadata.gz: 22514a54cff330d7efdd782b01864c20eb9f6b04b70ff76ca7cbbf56369afcbc4129ad710fd66308bfbc58011960afc1b9085e737a96c814caff4127427094fb
7
- data.tar.gz: de929ed9ed74bdc1fb168ecc7ff4fa69f929ad949f9a5d6f1275c9b66aef6b9932d83a0db54ffb4e633b5dde95b0ed90ccfbc0faff772b2650f9b5bc0b1714f2
6
+ metadata.gz: 82734af6ca9ecc542d94d5880e2203668f8e90cf14113172d0312b71b8200a9436176054647681f708c29f89a9f175163971b053334d75c25552095166fe272d
7
+ data.tar.gz: e74bfda44591c57ac21bfa6ef6b6a107cb0ab0471b3c6fde5cbf187124e6689a5bac6c9a4a3c9c12d5ade497b3cf7dff72eb00a819d7236c74e83f58b5349bf4
data/README.md CHANGED
@@ -40,7 +40,7 @@ contributed patches.)
40
40
  ## Dependencies
41
41
 
42
42
  * Ruby >= 1.9.3
43
- * Groonga >= 4.0.7
43
+ * Groonga >= 4.0.9
44
44
 
45
45
  ## Install
46
46
 
@@ -1,5 +1,21 @@
1
1
  h1. NEWS
2
2
 
3
+ h2(#4-0-8). 4.0.8: 2014-01-08
4
+
5
+ h3. Improvements
6
+
7
+ * Supported Groonga 4.0.9. Groonga 4.0.8 or older aren't supported.
8
+ * Added {Groonga::Column#truncate}. [GitHub#41] [Patch by Hiroshi Hatake]
9
+ * Added {Groonga::Database#recover}.
10
+
11
+ h3. Fixes
12
+
13
+ * Fixed a typo in {Groonga::GeoPoint#==}.
14
+
15
+ h3. Thanks
16
+
17
+ * Hiroshi Hatake
18
+
3
19
  h2(#4-0-7). 4.0.7: 2014-12-12
4
20
 
5
21
  h3. Improvements
@@ -9,7 +25,7 @@ h3. Improvements
9
25
  {Groonga::IndexCursor#each}. The option improves performance by
10
26
  reducing memory allocation. The option is disabled by default because
11
27
  reusing the same object isn't Rubyish.
12
- * Added {Groonga::IndexCursor#estimate_size}. [GitHub#38]
28
+ * Added {Groonga::IndexColumn#estimate_size}. [GitHub#38]
13
29
  * Accepted string for integer, unsigned integer and float type key.
14
30
 
15
31
  h2(#4-0-6). 4.0.6: 2014-11-06
@@ -192,8 +192,9 @@ def build_groonga_from_git(major, minor, micro)
192
192
  FileUtils.rm_rf("groonga")
193
193
  message(" done\n")
194
194
 
195
+ repository_url = "https://github.com/groonga/groonga.git"
195
196
  run_command("cloning...",
196
- "git clone --depth 1 https://github.com/groonga/groonga")
197
+ "git clone --recursive --depth 1 #{repository_url}")
197
198
 
198
199
  Dir.chdir("groonga") do
199
200
  run_command("running autogen.sh...",
@@ -608,6 +608,36 @@ rb_grn_column_reference_p (VALUE self)
608
608
  }
609
609
  }
610
610
 
611
+ /*
612
+ * Clears all values in column.
613
+ *
614
+ * This method is a dangerous method. You can't use this method when
615
+ * other process is using the column. The other process that is using
616
+ * the column must re-open its database after this method is done.
617
+ *
618
+ * @since 4.0.8
619
+ *
620
+ * @overload truncate
621
+ * @return void
622
+ */
623
+ static VALUE
624
+ rb_grn_column_truncate (VALUE self)
625
+ {
626
+ grn_ctx *context;
627
+ grn_obj *column;
628
+ grn_rc rc;
629
+
630
+ rb_grn_column_deconstruct(SELF(self), &column, &context,
631
+ NULL, NULL,
632
+ NULL, NULL, NULL);
633
+ rc = grn_column_truncate(context, column);
634
+
635
+ rb_grn_context_check(context, self);
636
+ rb_grn_rc_check(rc, self);
637
+
638
+ return Qnil;
639
+ }
640
+
611
641
  /*
612
642
  * _column_ が {Groonga::IndexColumn} の場合は +true+ を返し、
613
643
  * そうでない場合は +false+ を返す。
@@ -802,6 +832,7 @@ rb_grn_init_column (VALUE mGrn)
802
832
  rb_define_method(rb_cGrnColumn, "clear_lock", rb_grn_column_clear_lock, -1);
803
833
  rb_define_method(rb_cGrnColumn, "locked?", rb_grn_column_is_locked, -1);
804
834
  rb_define_method(rb_cGrnColumn, "reference?", rb_grn_column_reference_p, 0);
835
+ rb_define_method(rb_cGrnColumn, "truncate", rb_grn_column_truncate, 0);
805
836
  /* deprecated: backward compatibility */
806
837
  rb_define_alias(rb_cGrnColumn, "reference_column?", "reference?");
807
838
  rb_define_method(rb_cGrnColumn, "index?", rb_grn_column_index_p, 0);
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2015 Kouhei Sutou <kou@clear-code.com>
4
4
 
5
5
  This library is free software; you can redistribute it and/or
6
6
  modify it under the terms of the GNU Lesser General Public
@@ -562,6 +562,37 @@ rb_grn_database_defrag (int argc, VALUE *argv, VALUE self)
562
562
  return INT2NUM(n_segments);
563
563
  }
564
564
 
565
+ /*
566
+ * Recovers database.
567
+ *
568
+ * @overload recover()
569
+ *
570
+ * If the database is broken, try to recover the database. If the
571
+ * database can't be recovered, an {Groonga::Error} family exception
572
+ * is raised.
573
+ *
574
+ * If the database isn't broken, it does nothing.
575
+ *
576
+ * @return [void]
577
+ *
578
+ * @since 4.0.8
579
+ */
580
+ static VALUE
581
+ rb_grn_database_recover (VALUE self)
582
+ {
583
+ grn_rc rc;
584
+ grn_ctx *context;
585
+ grn_obj *database;
586
+
587
+ rb_grn_database_deconstruct(SELF(self), &database, &context,
588
+ NULL, NULL, NULL, NULL);
589
+ rc = grn_db_recover(context, database);
590
+ rb_grn_context_check(context, self);
591
+ rb_grn_rc_check(rc, self);
592
+
593
+ return Qnil;
594
+ }
595
+
565
596
  void
566
597
  rb_grn_init_database (VALUE mGrn)
567
598
  {
@@ -593,4 +624,5 @@ rb_grn_init_database (VALUE mGrn)
593
624
 
594
625
  rb_define_method(rb_cGrnDatabase, "touch", rb_grn_database_touch, 0);
595
626
  rb_define_method(rb_cGrnDatabase, "defrag", rb_grn_database_defrag, -1);
627
+ rb_define_method(rb_cGrnDatabase, "recover", rb_grn_database_recover, 0);
596
628
  }
@@ -2184,7 +2184,7 @@ rb_grn_table_select (int argc, VALUE *argv, VALUE self)
2184
2184
  if (!NIL_P(options))
2185
2185
  rb_raise(rb_eArgError,
2186
2186
  "should be [query_string, option_hash], "
2187
- "[expression, opion_hash] "
2187
+ "[expression, option_hash] "
2188
2188
  "or [option_hash]: %s",
2189
2189
  rb_grn_inspect(rb_ary_new4(argc, argv)));
2190
2190
  options = condition_or_options;
@@ -92,7 +92,7 @@ RB_GRN_BEGIN_DECLS
92
92
 
93
93
  #define RB_GRN_MAJOR_VERSION 4
94
94
  #define RB_GRN_MINOR_VERSION 0
95
- #define RB_GRN_MICRO_VERSION 7
95
+ #define RB_GRN_MICRO_VERSION 8
96
96
 
97
97
  #define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
98
98
 
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
4
5
  #
5
6
  # This library is free software; you can redistribute it and/or
6
7
  # modify it under the terms of the GNU Lesser General Public
@@ -136,7 +137,7 @@ module Groonga
136
137
  def ==(other)
137
138
  case other
138
139
  when String
139
- to_s == otehr
140
+ to_s == other
140
141
  when GeoPoint
141
142
  normalized_self = to_msec
142
143
  normalized_other = coerce(other).to_msec
@@ -19,15 +19,15 @@ module RroongaBuild
19
19
  module RequiredGroongaVersion
20
20
  MAJOR = 4
21
21
  MINOR = 0
22
- MICRO = 8
22
+ MICRO = 9
23
23
  VERSION = [MAJOR, MINOR, MICRO]
24
- RELEASED_DATE = Time.utc(2014, 11, 29)
24
+ RELEASED_DATE = Time.utc(2014, 12, 29)
25
25
  end
26
26
 
27
27
  module LatestGroongaVersion
28
28
  MAJOR = 4
29
29
  MINOR = 0
30
- MICRO = 8
30
+ MICRO = 9
31
31
  VERSION = [MAJOR, MINOR, MICRO]
32
32
  end
33
33
 
@@ -172,7 +172,7 @@ class ColumnTest < Test::Unit::TestCase
172
172
  assert_equal(<<-INSPECTED.chomp, result.expression.inspect)
173
173
  #<Groonga::Expression #<expr
174
174
  vars:{
175
- $1:#<record:hash:Posts id:0(nonexistent)>
175
+ $1:#<record:hash:Posts id:(no value)>
176
176
  },
177
177
  codes:{
178
178
  0:<get_value(), modify:2, value:#<column:var_size Posts.body range:Text type:scalar compress:none>>,
@@ -212,7 +212,7 @@ class ColumnTest < Test::Unit::TestCase
212
212
  assert_equal(<<-INSPECTED.chomp, result.expression.inspect)
213
213
  #<Groonga::Expression #<expr
214
214
  vars:{
215
- $1:#<record:hash:Posts id:0(nonexistent)>
215
+ $1:#<record:hash:Posts id:(no value)>
216
216
  },
217
217
  codes:{
218
218
  0:<get_value(), modify:2, value:#<column:var_size Posts.body range:Text type:scalar compress:none>>,
@@ -239,10 +239,10 @@ class ColumnTest < Test::Unit::TestCase
239
239
  assert_equal(<<-INSPECTED.chomp, result.expression.inspect)
240
240
  #<Groonga::Expression #<expr
241
241
  vars:{
242
- $1:#<record:hash:Posts id:0(nonexistent)>
242
+ $1:#<record:hash:Posts id:(no value)>
243
243
  },
244
244
  codes:{
245
- 0:<push(), modify:0, value:#<record:hash:Posts id:0(nonexistent)>>,
245
+ 0:<push(), modify:0, value:#<record:hash:Posts id:(no value)>>,
246
246
  1:<get_value(), modify:2, value:#<column:var_size Posts.body range:Text type:scalar compress:none>>,
247
247
  2:<push(), modify:0, value:"drive">,
248
248
  3:<match(), modify:0, value:(NULL)>
@@ -264,10 +264,10 @@ class ColumnTest < Test::Unit::TestCase
264
264
  assert_equal(<<-INSPECTED.chomp, result.expression.inspect)
265
265
  #<Groonga::Expression #<expr
266
266
  vars:{
267
- $1:#<record:hash:Posts id:0(nonexistent)>
267
+ $1:#<record:hash:Posts id:(no value)>
268
268
  },
269
269
  codes:{
270
- 0:<push(), modify:1, value:#<record:hash:Posts id:0(nonexistent)>>,
270
+ 0:<push(), modify:1, value:#<record:hash:Posts id:(no value)>>,
271
271
  1:<get_value(), modify:2, value:#<column:var_size Posts.body range:Text type:scalar compress:none>>,
272
272
  2:<push(), modify:0, value:"drive">,
273
273
  3:<match(), modify:0, value:(NULL)>
@@ -518,4 +518,66 @@ class ColumnTest < Test::Unit::TestCase
518
518
  assert_nil(@users.column("name"))
519
519
  end
520
520
  end
521
+
522
+ class TruncateTest < self
523
+ def setup
524
+ setup_database
525
+
526
+ setup_schema
527
+ end
528
+
529
+ def setup_schema
530
+ Groonga::Schema.define do |schema|
531
+ schema.create_table("Posts",
532
+ :type => :hash,
533
+ :key_type => "ShortText") do |table|
534
+ table.text("body")
535
+ end
536
+ end
537
+
538
+ @posts = Groonga["Posts"]
539
+ end
540
+
541
+ def test_not_indexed
542
+ body1 = "body1"
543
+ body2 = "body2"
544
+ records = [
545
+ @posts.add("title1", :body => body1),
546
+ @posts.add("title2", :body => body2),
547
+ ]
548
+
549
+ assert_equal([body1, body2],
550
+ records.collect(&:body))
551
+ @posts.column("body").truncate
552
+ assert_equal([nil, nil],
553
+ records.collect(&:body))
554
+ end
555
+
556
+ def test_indexed
557
+ Groonga::Schema.define do |schema|
558
+ schema.create_table("Terms",
559
+ :type => :patricia_trie,
560
+ :key_type => "ShortText",
561
+ :default_tokenizer => "TokenBigram",
562
+ :normalizer => "NormalizerAuto") do |table|
563
+ table.index("Posts.body")
564
+ end
565
+ end
566
+
567
+ post1 = @posts.add("title1", :body => "body1")
568
+ post2 = @posts.add("title2", :body => "body2")
569
+
570
+ select = lambda do
571
+ @posts.select {|record| record.body =~ "1"}.collect(&:_key)
572
+ end
573
+
574
+ assert_equal(["title1"], select.call)
575
+ @posts.column("body").truncate
576
+ assert_equal([], select.call)
577
+
578
+ post1.body = "body1"
579
+ post2.body = "body2"
580
+ assert_equal(["title1"], select.call)
581
+ end
582
+ end
521
583
  end
@@ -202,8 +202,6 @@ class CommandSelectTest < Test::Unit::TestCase
202
202
  end
203
203
 
204
204
  class EscapeTest < self
205
- setup :setup_database
206
-
207
205
  def test_backslash
208
206
  key = "the \\ book"
209
207
  @books.add(key, :published => Time.parse("2011/04/01"))
@@ -234,5 +232,4 @@ class CommandSelectTest < Test::Unit::TestCase
234
232
  result.records)
235
233
  end
236
234
  end
237
-
238
235
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2015 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
@@ -171,6 +171,33 @@ class DatabaseTest < Test::Unit::TestCase
171
171
  assert_equal(2, @database.defrag)
172
172
  end
173
173
 
174
+ def test_recover
175
+ setup_database
176
+ Groonga::Schema.define do |schema|
177
+ schema.create_table("Users") do |table|
178
+ table.short_text("name")
179
+ end
180
+
181
+ schema.create_table("Terms",
182
+ :type => :patricia_trie,
183
+ :key_type => :short_text,
184
+ :default_tokenizer => "TokenBigram",
185
+ :normalizer => "NormalizerAuto") do |table|
186
+ table.index("Users.name")
187
+ end
188
+ end
189
+
190
+ index = context["Terms.Users_name"]
191
+ index.lock
192
+ assert do
193
+ index.locked?
194
+ end
195
+ @database.recover
196
+ assert do
197
+ not index.locked?
198
+ end
199
+ end
200
+
174
201
  def test_tables
175
202
  setup_database
176
203
  Groonga::Schema.define do |schema|
@@ -1,4 +1,5 @@
1
1
  # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
@@ -185,6 +186,20 @@ class GeoPointTest < Test::Unit::TestCase
185
186
  assert_equal(geo_point1, geo_point2)
186
187
  end
187
188
  end
189
+
190
+ class StringTest < self
191
+ def test_degree
192
+ geo_point1 = Groonga::WGS84GeoPoint.new(35.6846084, 139.7628746)
193
+ geo_point2 = "35.6846084x139.7628746"
194
+ assert_equal(geo_point1, geo_point2)
195
+ end
196
+
197
+ def test_msec
198
+ geo_point1 = Groonga::WGS84GeoPoint.new(128464590, 503146349)
199
+ geo_point2 = "128464590x503146349"
200
+ assert_equal(geo_point1, geo_point2)
201
+ end
202
+ end
188
203
  end
189
204
  end
190
205
  end
@@ -145,7 +145,7 @@ class VariableSizeColumnTest < Test::Unit::TestCase
145
145
 
146
146
  class StringTest < self
147
147
  def test_append
148
- omit("append for non table domain column isn't supported by groonga.")
148
+ omit("append for non table domain column isn't supported by Groonga.")
149
149
  assert_equal([], @morita["nick_names"])
150
150
  @morita.append("nick_names", "morita")
151
151
  assert_equal(["morita"], @morita["nick_names"])
@@ -154,7 +154,7 @@ class VariableSizeColumnTest < Test::Unit::TestCase
154
154
  end
155
155
 
156
156
  def test_prepend
157
- omit("prepend for non table domain column isn't supported by groonga.")
157
+ omit("prepend for non table domain column isn't supported by Groonga.")
158
158
  assert_equal([], @morita["nick_names"])
159
159
  @morita.prepend("nick_names", "morita")
160
160
  assert_equal(["morita"], @morita["nick_names"])
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: 4.0.7
4
+ version: 4.0.8
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: 2014-12-12 00:00:00.000000000 Z
15
+ date: 2015-01-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config
@@ -194,10 +194,10 @@ email:
194
194
  - y.hayamizu@gmail.com
195
195
  - dara@shidara.net
196
196
  executables:
197
- - grntest-log-analyze
197
+ - groonga-index-dump
198
198
  - grndump
199
199
  - groonga-database-inspect
200
- - groonga-index-dump
200
+ - grntest-log-analyze
201
201
  extensions:
202
202
  - ext/groonga/extconf.rb
203
203
  extra_rdoc_files:
@@ -375,57 +375,57 @@ specification_version: 4
375
375
  summary: Ruby bindings for Groonga that provide full text search and column store
376
376
  features.
377
377
  test_files:
378
- - test/test-schema-create-table.rb
379
- - test/test-type.rb
380
- - test/test-table-select.rb
381
- - test/test-variable-size-column.rb
382
- - test/test-table-select-normalize.rb
383
- - test/test-lock-timeout.rb
384
- - test/test-record.rb
385
- - test/test-plugin.rb
386
- - test/groonga-test-utils.rb
387
- - test/test-logger.rb
378
+ - test/test-schema.rb
388
379
  - test/test-snippet.rb
389
- - test/test-memory-pool.rb
390
- - test/test-command-select.rb
391
- - test/test-expression-builder.rb
392
- - test/test-database-dumper.rb
393
- - test/test-encoding.rb
394
380
  - test/test-variable.rb
395
- - test/test-context.rb
396
- - test/run-test.rb
397
- - test/test-index-cursor.rb
398
- - test/test-table-select-mecab.rb
381
+ - test/test-geo-point.rb
382
+ - test/test-plugin.rb
383
+ - test/test-accessor.rb
399
384
  - test/test-double-array-trie.rb
400
- - test/test-sub-records.rb
401
- - test/test-table-offset-and-limit.rb
402
- - test/test-table-select-weight.rb
403
- - test/test-convert.rb
385
+ - test/test-pagination.rb
386
+ - test/test-memory-pool.rb
404
387
  - test/test-column.rb
405
- - test/test-table.rb
406
- - test/test-gqtp.rb
407
388
  - test/test-table-traverse.rb
408
- - test/test-schema.rb
389
+ - test/test-expression.rb
390
+ - test/test-table-select.rb
391
+ - test/test-encoding.rb
392
+ - test/test-logger.rb
393
+ - test/test-schema-create-table.rb
394
+ - test/test-hash.rb
395
+ - test/test-type.rb
396
+ - test/test-table-offset-and-limit.rb
409
397
  - test/test-version.rb
410
- - test/test-exception.rb
411
- - test/test-array.rb
412
- - test/test-patricia-trie.rb
413
- - test/test-schema-type.rb
414
- - test/test-database.rb
398
+ - test/test-lock-timeout.rb
415
399
  - test/test-index-column.rb
416
- - test/test-normalizer.rb
400
+ - test/test-table-key-support.rb
417
401
  - test/test-vector-column.rb
418
- - test/test-database-inspector.rb
419
- - test/test-pagination.rb
402
+ - test/test-normalizer.rb
403
+ - test/test-table-select-weight.rb
404
+ - test/test-schema-type.rb
405
+ - test/test-sub-records.rb
420
406
  - test/test-procedure.rb
421
- - test/test-geo-point.rb
422
- - test/test-table-key-support.rb
423
- - test/test-statistic-measurer.rb
424
- - test/test-fix-size-column.rb
425
- - test/test-accessor.rb
426
- - test/test-hash.rb
427
- - test/test-expression.rb
407
+ - test/test-context.rb
408
+ - test/test-gqtp.rb
428
409
  - test/test-remote.rb
410
+ - test/test-database-dumper.rb
411
+ - test/test-database-inspector.rb
412
+ - test/test-patricia-trie.rb
413
+ - test/run-test.rb
414
+ - test/test-fix-size-column.rb
415
+ - test/test-statistic-measurer.rb
416
+ - test/test-array.rb
417
+ - test/test-table.rb
418
+ - test/groonga-test-utils.rb
419
+ - test/test-record.rb
420
+ - test/test-exception.rb
421
+ - test/test-table-select-normalize.rb
429
422
  - test/test-schema-dumper.rb
430
423
  - test/test-table-dumper.rb
424
+ - test/test-database.rb
425
+ - test/test-variable-size-column.rb
426
+ - test/test-table-select-mecab.rb
427
+ - test/test-expression-builder.rb
428
+ - test/test-convert.rb
429
+ - test/test-index-cursor.rb
430
+ - test/test-command-select.rb
431
431
  has_rdoc: