rroonga 12.0.8 → 12.1.0

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
  SHA256:
3
- metadata.gz: 908cb7325ae81681705d729d998fc1a8340110f4917c2cbe3f909e89e49b022e
4
- data.tar.gz: d3dd3039d9dfc63b4d13aaa9bbd7db3db7f9024ca5894755b1aeb0e7f1217571
3
+ metadata.gz: a85769bf192cecc677daaaddb349b4728bdeb7d240d1ecb4fc9660495c5fa2de
4
+ data.tar.gz: 05375332c1e8f93a9e1fb1b584a9e92d8923af6848ffdef223702a17d32852a8
5
5
  SHA512:
6
- metadata.gz: 8ab6d48f53a1f0672f814c423b40df8fe4d5963eee26345bcd308440fe4456ea65b9af4d7ca0614771194931a18388a3a2f6fef0ccafb846759fbc750dfd3f6e
7
- data.tar.gz: ba3747fa4338baf72277de7acaf5a35354bb032224d992af00c3c7e6ce0e58c3aeed355cb3d4e811335a3f99d8cbadc114c629f1915e7397fdd638e86e39176b
6
+ metadata.gz: 3ec5e421bb75cdf1c944fcf36f70778f59113da9a8c4c20df7318fd56e21a1f00856fe9a9f308cab584183c32cbf055758b3e6bd52d415771c3f0c28080588bf
7
+ data.tar.gz: d7d630a97a5831323c70ececc208016d4a5a02b4ddd476e043038eca71e8b6d37410d01c7eac8d5eb71b0788d7fbcc915d76737dfa38c0f3db02f1cc92b9884f
data/doc/text/news.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # NEWS
2
2
 
3
+ ## 12.1.0: 2022-12-05 {#version-12-1-0}
4
+
5
+ ### Fixes
6
+
7
+ * [{Groonga::PatriciaTrie}] Fixed a bug that `Groonga::PatriciaTrie#scan` returned wrong offsets if there are many hit words. [GitHub#207][Patch by Naoya Murakami]
8
+
9
+ ### Thanks
10
+
11
+ * Naoya Murakami
12
+
3
13
  ## 12.0.8: 2022-09-28 {#version-12-0-8}
4
14
 
5
15
  ### Improvements
@@ -445,10 +445,14 @@ rb_grn_patricia_trie_scan (VALUE self, VALUE rb_string)
445
445
  grn_pat_scan_hit hits[1024];
446
446
  const char *string;
447
447
  long string_length;
448
+ const char *original_string;
449
+ long rest_offset;
448
450
  grn_bool block_given;
449
451
 
450
452
  string = StringValuePtr(rb_string);
451
453
  string_length = RSTRING_LEN(rb_string);
454
+ original_string = string;
455
+ rest_offset = 0;
452
456
 
453
457
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
454
458
  NULL, NULL, NULL,
@@ -481,7 +485,7 @@ rb_grn_patricia_trie_scan (VALUE self, VALUE rb_string)
481
485
  matched_info = rb_ary_new_from_args(4,
482
486
  record,
483
487
  term,
484
- UINT2NUM(hits[i].offset),
488
+ UINT2NUM(hits[i].offset + rest_offset),
485
489
  UINT2NUM(hits[i].length));
486
490
  if (block_given) {
487
491
  rb_yield(matched_info);
@@ -490,6 +494,7 @@ rb_grn_patricia_trie_scan (VALUE self, VALUE rb_string)
490
494
  }
491
495
  previous_offset = hits[i].offset;
492
496
  }
497
+ rest_offset = rest - original_string;
493
498
  string_length -= rest - string;
494
499
  string = rest;
495
500
  }
data/ext/groonga/rb-grn.h CHANGED
@@ -92,8 +92,8 @@ RB_GRN_BEGIN_DECLS
92
92
  #define RB_GRN_HAVE_FLOAT32 GRN_VERSION_OR_LATER(10, 0, 2)
93
93
 
94
94
  #define RB_GRN_MAJOR_VERSION 12
95
- #define RB_GRN_MINOR_VERSION 0
96
- #define RB_GRN_MICRO_VERSION 8
95
+ #define RB_GRN_MINOR_VERSION 1
96
+ #define RB_GRN_MICRO_VERSION 0
97
97
 
98
98
  #define RB_GRN_OBJECT(object) ((RbGrnObject *)(object))
99
99
  #define RB_GRN_NAMED_OBJECT(object) ((RbGrnNamedObject *)(object))
@@ -154,6 +154,23 @@ class PatriciaTrieTest < Test::Unit::TestCase
154
154
  words.scan('muTEki リンクの冒険 ミリバール アルパカ ガッ'))
155
155
  end
156
156
 
157
+ def test_scan_for_many_words
158
+ Groonga::Context.default_options = {:encoding => "utf-8"}
159
+ words = Groonga::PatriciaTrie.create(:key_type => "ShortText",
160
+ :key_normalize => true)
161
+ words.add("x")
162
+ dot = words.add(".")
163
+ longtext = ""
164
+ scanned = []
165
+
166
+ 1025.times.each do |i|
167
+ longtext += "."
168
+ scanned.push([dot, ".", i, 1])
169
+ end
170
+ assert_equal(scanned,
171
+ words.scan(longtext))
172
+ end
173
+
157
174
  def test_scan_no_database
158
175
  Groonga::Context.open(encoding: "utf-8") do |context|
159
176
  Groonga::PatriciaTrie.create(context: 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: 12.0.8
4
+ version: 12.1.0
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: 2022-09-28 00:00:00.000000000 Z
15
+ date: 2022-12-06 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: groonga-client
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
387
  - !ruby/object:Gem::Version
388
388
  version: '0'
389
389
  requirements: []
390
- rubygems_version: 3.3.15
390
+ rubygems_version: 3.3.24
391
391
  signing_key:
392
392
  specification_version: 4
393
393
  summary: Ruby bindings for Groonga that provide full text search and column store