rroonga 9.0.2 → 10.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Rakefile +9 -142
  4. data/doc/text/news.md +73 -1
  5. data/doc/text/tutorial.md +1 -1
  6. data/ext/groonga/extconf.rb +9 -74
  7. data/ext/groonga/rb-grn-context.c +27 -0
  8. data/ext/groonga/rb-grn-expression-builder.c +3 -3
  9. data/ext/groonga/rb-grn-flushable.c +7 -0
  10. data/ext/groonga/rb-grn-index-column.c +28 -0
  11. data/ext/groonga/rb-grn-index-cursor.c +19 -0
  12. data/ext/groonga/rb-grn-logger.c +17 -3
  13. data/ext/groonga/rb-grn-object.c +236 -22
  14. data/ext/groonga/rb-grn-table-key-support.c +26 -7
  15. data/ext/groonga/rb-grn-table.c +119 -87
  16. data/ext/groonga/rb-grn-type.c +5 -1
  17. data/ext/groonga/rb-grn-utils.c +17 -1
  18. data/ext/groonga/rb-grn.h +7 -13
  19. data/ext/groonga/rb-groonga.c +2 -2
  20. data/lib/groonga.rb +3 -7
  21. data/lib/groonga/dumper.rb +3 -0
  22. data/lib/groonga/record.rb +2 -2
  23. data/rroonga.gemspec +4 -5
  24. data/test/groonga-test-utils.rb +34 -5
  25. data/test/run-test.rb +1 -3
  26. data/test/test-accessor.rb +63 -7
  27. data/test/test-column.rb +12 -1
  28. data/test/test-context.rb +25 -0
  29. data/test/test-exception.rb +5 -0
  30. data/test/test-flushable.rb +51 -6
  31. data/test/test-index-column.rb +67 -6
  32. data/test/test-index-cursor.rb +26 -0
  33. data/test/test-logger.rb +56 -11
  34. data/test/test-plugin.rb +1 -0
  35. data/test/test-query-logger.rb +4 -3
  36. data/test/test-record.rb +2 -1
  37. data/test/test-remote.rb +56 -10
  38. data/test/test-schema-dumper.rb +13 -0
  39. data/test/test-schema.rb +9 -1
  40. data/test/test-table-arrow.rb +1 -1
  41. data/test/test-table.rb +21 -1
  42. data/test/test-variable.rb +23 -7
  43. metadata +65 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43bad421fe95e5e2fc151ec07685791eea3af24391b3f304bed7edaf4a134322
4
- data.tar.gz: c7f44d05c376ad9db717da49587255566196ddbfb35704355dbe7f623fb86248
3
+ metadata.gz: f2dda7dccd26063c5e82e93255c933215a21a37e0c31838eec124b3f12ce3892
4
+ data.tar.gz: 472fed29e2ba91ff00dd71981ff59a6866c9a292ea7ac83dc5881bd1069536e1
5
5
  SHA512:
6
- metadata.gz: b336ca9f19ae221c6a67e9b33b36abdcd5df013f8bfbebc3c90394e4c1c67ef9086634357688779122cd528f0266e994ab7e76402fbf5bcfd0fc32adc9e1f027
7
- data.tar.gz: 6b08a37322b308430e92e8f2878fde3c537b658eeb79f96199c782f95d4225e0cde3483b9ece46fd71423a03afab986fc765f676354ec4f2b269a495c0a283f7
6
+ metadata.gz: 0f4c1aa03b1efc04321588d3dfac9a208dafc35c2a1a84724e47a035a1a3eb7cabeaa6d58655fe6e324c1fbfa706812a5c0cdb817686cbde2a947659c3231c76
7
+ data.tar.gz: fe41f7d510f5ddb1cdd88a8d6de87d477f0f45714f09691b01b2a750bd89c31dd2a60ae334f15e216bfa4fa7752f10f765112efce4c75ecd7084a42b27af837f
data/.yardopts CHANGED
@@ -1,6 +1,7 @@
1
1
  --output-dir doc/reference/en
2
2
  --markup markdown
3
3
  --markup-provider kramdown
4
+ --asset doc/images:images
4
5
  lib/**/*.rb
5
6
  ext/**/*.c
6
7
  -
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- # -*- coding: utf-8; mode: ruby -*-
1
+ # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2009-2019 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2009-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  # Copyright (C) 2017 Masafumi Yokoyama <yokoyama@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -16,15 +16,9 @@
16
16
  # License along with this library; if not, write to the Free Software
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
- require "find"
20
- require "fileutils"
21
- require "shellwords"
22
- require "pathname"
23
- require "erb"
24
- require "yard"
25
19
  require "bundler/gem_helper"
26
- require "rake/extensiontask"
27
20
  require "packnga"
21
+ require "yard"
28
22
 
29
23
  base_dir = File.join(File.dirname(__FILE__))
30
24
 
@@ -52,73 +46,6 @@ Packnga::ReleaseTask.new(spec) do |task|
52
46
  task.index_html_dir = ranguba_org_dir
53
47
  end
54
48
 
55
- module YARD
56
- module CodeObjects
57
- class Proxy
58
- alias_method :initialize_original, :initialize
59
- def initialize(namespace, name, type=nil)
60
- name = name.to_s.gsub(/\AGrn(.*)\z/) do
61
- suffix = $1
62
- case suffix
63
- when ""
64
- "Groonga"
65
- when "TableKeySupport"
66
- "Groonga::Table::KeySupport"
67
- else
68
- "Groonga::#{suffix}"
69
- end
70
- end
71
- initialize_original(namespace, name, type)
72
- end
73
- end
74
- end
75
- end
76
-
77
- def windows?(platform=nil)
78
- platform ||= RUBY_PLATFORM
79
- platform =~ /mswin(?!ce)|mingw|cygwin|bccwin/
80
- end
81
-
82
- def collect_binary_files(binary_dir)
83
- binary_files = []
84
- Find.find(binary_dir) do |name|
85
- next unless File.file?(name)
86
- next if /\.zip\z/i =~ name
87
- binary_files << name
88
- end
89
- binary_files
90
- end
91
-
92
- def windows_gem_name(spec, architecture)
93
- "#{spec.name}-#{spec.version}-#{architecture}-mingw32.gem"
94
- end
95
-
96
- relative_vendor_dir = "vendor"
97
- relative_binary_dir = File.join("vendor", "local")
98
- vendor_dir = File.join(base_dir, relative_vendor_dir)
99
- binary_dir = File.join(base_dir, relative_binary_dir)
100
-
101
- groonga_win32_i386_p = ENV["RROONGA_USE_GROONGA_X64"].nil?
102
-
103
- Rake::ExtensionTask.new("groonga", spec) do |ext|
104
- if groonga_win32_i386_p
105
- ext.cross_platform = ["x86-mingw32"]
106
- else
107
- ext.cross_platform = ["x64-mingw32"]
108
- end
109
- if windows?
110
- ext.gem_spec.files += collect_binary_files(relative_binary_dir)
111
- else
112
- ext.cross_compile = true
113
- ext.cross_compiling do |_spec|
114
- if windows?(_spec.platform.to_s)
115
- binary_files = collect_binary_files(relative_binary_dir)
116
- _spec.files += binary_files
117
- end
118
- end
119
- end
120
- end
121
-
122
49
  file "Makefile" => ["extconf.rb", "ext/groonga/extconf.rb"] do
123
50
  extconf_args = []
124
51
  if ENV["TRAVIS"]
@@ -136,75 +63,15 @@ task :test => :configure do
136
63
  end
137
64
 
138
65
  namespace :test do
139
- task :install do
140
- gemspec_helper = Rake.application.jeweler.gemspec_helper
141
- ruby("-S gem install --user-install #{gemspec_helper.gem_path}")
142
-
143
- gem_spec = Gem.source_index.find_name("rroonga").last
144
- installed_path = gem_spec.full_gem_path
66
+ task :install => "install" do
67
+ rroonga_specs = Gem.source_index.find_name("rroonga")
68
+ target_rroonga_spec = rroonga_specs.find do |rroonga_spec|
69
+ rroonga_spec.version == helper.gemspec.version
70
+ end
71
+ installed_path = target_rroonga_spec.full_gem_path
145
72
  ENV["NO_MAKE"] = "yes"
146
73
  ruby("#{installed_path}/test/run-test.rb")
147
74
  end
148
75
  end
149
76
 
150
- desc "Remove Groonga binary directory"
151
- namespace :clean do
152
- task :groonga do
153
- rm_rf binary_dir
154
- end
155
- end
156
-
157
- windows_architectures = [:x86, :x64]
158
-
159
- namespace :build do
160
- namespace :windows do
161
- ruby_versions = "2.1.6:2.2.2:2.3.0:2.4.0:2.5.0"
162
-
163
- windows_architectures.each do |architecture|
164
- desc "Build gem for Windows #{architecture}"
165
- task architecture do
166
- build_dir = "tmp/windows"
167
- rm_rf build_dir
168
- mkdir_p build_dir
169
-
170
- commands = [
171
- ["git", "clone", "file://#{Dir.pwd}/.git", build_dir],
172
- ["cd", build_dir],
173
- ["gem", "install", "json"],
174
- ["bundle"],
175
- ["rake", "cross", "native", "gem", "RUBY_CC_VERSION=#{ruby_versions}"],
176
- ]
177
- if architecture == :x64
178
- commands.unshift(["export", "RROONGA_USE_GROONGA_X64=true"])
179
- end
180
- raw_commands = commands.collect do |command|
181
- Shellwords.join(command)
182
- end
183
- raw_command_line = raw_commands.join(" && ")
184
-
185
- require "rake_compiler_dock"
186
- RakeCompilerDock.sh(raw_command_line)
187
-
188
- cp("#{build_dir}/pkg/#{windows_gem_name(spec, architecture)}",
189
- "pkg/")
190
- end
191
- end
192
- end
193
-
194
- desc "Build gems for Windows"
195
- build_tasks = windows_architectures.collect do |architecture|
196
- "windows:#{architecture}"
197
- end
198
- task :windows => build_tasks
199
- end
200
-
201
- namespace :release do
202
- desc "Push gems for Windows to RubyGems.org"
203
- task :windows do
204
- windows_architectures.each do |architecture|
205
- ruby("-S", "gem", "push", "pkg/#{windows_gem_name(spec, architecture)}")
206
- end
207
- end
208
- end
209
-
210
77
  task :default => :test
@@ -1,5 +1,77 @@
1
1
  # NEWS
2
2
 
3
+ ## 10.0.6: 2020-09-01 {#version-10-0-6}
4
+
5
+ ### Fixes
6
+
7
+ * Fixed a bug that failed `gem install rroonga` in Windows version.
8
+
9
+ ## 10.0.2: 2020-04-29 {#version-10-0-2}
10
+
11
+ ### Improvements
12
+
13
+ * Added support for Float32 in Groonga 10.0.2.
14
+
15
+ * [doc] Fixed markup of a image in tutorial [GitHub#192][Patched by takahashim]
16
+
17
+ ### Thanks
18
+
19
+ * takahashim
20
+
21
+ ## 10.0.1: 2020-04-02 {#version-10-0-1}
22
+
23
+ ### Improvements
24
+
25
+ * Added support for creating a table with normalizer with options
26
+
27
+ * Windows: Added Ruby 2.7 support.
28
+
29
+ * Windows: Dropped Ruby 2.3.
30
+
31
+ * This version has been EOL.
32
+
33
+ * Dropped fat gem support.
34
+
35
+ ## 9.0.7: 2019-08-29 {#version-9-0-7}
36
+
37
+ ### Improvements
38
+
39
+ * {Groonga::Object#lexicon?} Added.
40
+
41
+ * {Groonga::IndexColumn} Added support "INDEX_LARGE".
42
+
43
+ * {Groonga::IndexCursor#set_min?} Added.
44
+
45
+ * {Groonga::IndexCursor#set_min=} Added.
46
+
47
+ * {Groonga::Context#force_match_escalation?} Added.
48
+
49
+ * {Groonga::Context#force_match_escalation=} Added.
50
+
51
+ * {Groonga::Object#id_accessor?} Added.
52
+
53
+ * {Groonga::Logger.flags} Added support for thread id option.
54
+
55
+ * {Groonga::Object#bulk?} Added.
56
+
57
+ * {Groonga::Object#value_accessor?} Added.
58
+
59
+ * {Groonga::Table} Delegate support_score? from Groonga::Record to Groonga::Table.
60
+
61
+ * Groonga::Flashable Added support dependent option.
62
+
63
+ * {Groonga::Object#score_accessor?} Added.
64
+
65
+ * {Groonga::Object#nsubrecs_accessor? } Added.
66
+
67
+ * Translate a part of explanation of Groonga::Table into English.
68
+
69
+ ## 9.0.3: 2019-05-10 {#version-9-0-3}
70
+
71
+ ### Improvements
72
+
73
+ * Windows: Added Ruby 2.6 support.
74
+
3
75
  ## 9.0.2: 2019-05-10 {#version-9-0-2}
4
76
 
5
77
  ### Improvements
@@ -9,7 +81,7 @@
9
81
  * Added support for "--with-groonga-configure-options".
10
82
  [GitHub#146][Reported by Tomás Pollak]
11
83
 
12
- * {Groonga::RegexpExpressionBuilder}: Added support (?-mix:XXX) for searching of regular expression.
84
+ * Groonga::RegexpExpressionBuilder: Added support (?-mix:XXX) for searching of regular expression.
13
85
  [groonga-dev,04694][Reported by Masatoshi SEKI]
14
86
 
15
87
  * Use "groonga-latest.tar.gz" for build Groonga.
@@ -178,7 +178,7 @@ bookmarks.
178
178
 
179
179
  First, you add tables for users and for comments like below:
180
180
 
181
- !http://qwik.jp/senna/senna2.files/rect4605.png!
181
+ ![Sample schema](images/sample-schema.png)
182
182
 
183
183
  Let's add the table for users, `Users`.
184
184
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2009-2019 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2009-2020 Sutou Kouhei <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
@@ -49,30 +49,11 @@ def win32?
49
49
  /cygwin|mingw|mswin/ =~ RUBY_PLATFORM
50
50
  end
51
51
 
52
- checking_for(checking_message("Win32 OS")) do
53
- win32 = win32?
54
- if win32
55
- $defs << "-DRB_GRN_PLATFORM_WIN32"
56
- import_library_name = "libruby-#{module_name}.a"
57
- $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
58
- $cleanfiles << import_library_name
59
- binary_base_dir = base_dir + "vendor" + "local"
60
- pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
61
- PKGConfig.add_path(pkg_config_dir.to_s)
62
- PKGConfig.set_override_variable("prefix", binary_base_dir.to_s)
63
- end
64
- win32
65
- end
66
-
67
52
  def install_groonga_locally
68
53
  FileUtils.mkdir_p(local_groonga_base_dir)
69
54
 
70
55
  Dir.chdir(local_groonga_base_dir) do
71
- if win32?
72
- extract_groonga_win32_binary
73
- else
74
- build_groonga
75
- end
56
+ build_groonga
76
57
  end
77
58
 
78
59
  prepend_pkg_config_path_for_local_groonga
@@ -107,50 +88,6 @@ def download(url)
107
88
  end
108
89
  end
109
90
 
110
- def extract_zip(filename, destrination_dir)
111
- require "archive/zip"
112
-
113
- Archive::Zip.extract(filename, destrination_dir)
114
- rescue LoadError
115
- command_line = ["unzip", filename, "-d", destrination_dir]
116
- unless system(*command_line)
117
- raise "Failed to unzip: #{command_line.join(' ')}"
118
- end
119
- end
120
-
121
- def extract_groonga_win32_binary
122
- if ENV["RROONGA_USE_GROONGA_X64"]
123
- architecture = "x64"
124
- else
125
- architecture = "x86"
126
- end
127
- zip = "groonga-latest-#{architecture}.zip"
128
- url = "https://packages.groonga.org/windows/groonga/#{zip}"
129
- install_dir = local_groonga_install_dir
130
-
131
- download(url)
132
-
133
- message("extracting...")
134
- before_paths = Dir.glob("*")
135
- extract_zip(zip, ".")
136
- extracted_dir = (Dir.glob("*") - before_paths).first
137
- message(" done\n")
138
-
139
- if File.exist?(install_dir)
140
- message("removing old install... #{install_dir}")
141
- FileUtils.rm_rf(install_dir)
142
- message(" done\n")
143
- end
144
-
145
- message("installing...")
146
- FileUtils.mv(extracted_dir, install_dir)
147
- message(" done\n")
148
-
149
- message("removing binary archive...")
150
- FileUtils.rm_rf(zip)
151
- message(" done\n")
152
- end
153
-
154
91
  def run_command(start_message, command)
155
92
  message(start_message)
156
93
  if xsystem(command)
@@ -247,6 +184,7 @@ def build_groonga_from_tar_gz
247
184
  FileUtils.mkdir_p(groonga_source_dir)
248
185
 
249
186
  message("extracting...")
187
+ # TODO: Use Zlip::GzipReader and Gem::Package::TarReader
250
188
  if xsystem("tar xfz #{tar_gz} -C #{groonga_source_dir} --strip-components=1")
251
189
  message(" done\n")
252
190
  else
@@ -285,14 +223,8 @@ def install_local_groonga(package_name, major, minor, micro)
285
223
  add_rpath_for_local_groonga
286
224
  end
287
225
 
288
- if win32?
289
- unless have_local_groonga?(package_name, major, minor, micro)
290
- install_local_groonga(package_name, major, minor, micro)
291
- end
292
- else
293
- unless PKGConfig.have_package(package_name, major, minor, micro)
294
- install_local_groonga(package_name, major, minor, micro)
295
- end
226
+ unless PKGConfig.have_package(package_name, major, minor, micro)
227
+ install_local_groonga(package_name, major, minor, micro)
296
228
  end
297
229
 
298
230
  real_version = PKGConfig.modversion(package_name)
@@ -335,7 +267,7 @@ end
335
267
 
336
268
  def enable_debug_build_flag(flags)
337
269
  if gcc?
338
- flags.gsub(/(^|\s)?-g\d?(\s|$)?/, '\\1-ggdb3\\2')
270
+ flags.gsub(/(^|\s)?-g\d?(\s|$)/, '\\1-ggdb3\\2')
339
271
  else
340
272
  flags
341
273
  end
@@ -347,6 +279,9 @@ checking_for(checking_message("--enable-debug-build option")) do
347
279
  $CFLAGS = disable_optimization_build_flag($CFLAGS)
348
280
  $CFLAGS = enable_debug_build_flag($CFLAGS)
349
281
 
282
+ CONFIG["optflags"] = disable_optimization_build_flag(CONFIG["optflags"])
283
+ CONFIG["debugflags"] = enable_debug_build_flag(CONFIG["debugflags"])
284
+
350
285
  CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"])
351
286
  CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"])
352
287
  end
@@ -2,6 +2,7 @@
2
2
  /*
3
3
  Copyright (C) 2010-2018 Kouhei Sutou <kou@clear-code.com>
4
4
  Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
5
+ Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
5
6
 
6
7
  This library is free software; you can redistribute it and/or
7
8
  modify it under the terms of the GNU Lesser General Public
@@ -604,6 +605,27 @@ rb_grn_context_get_ruby_encoding (VALUE self)
604
605
  return rb_grn_encoding_to_ruby_encoding_object(encoding);
605
606
  }
606
607
 
608
+ /*
609
+ * @overload force_match_escalation?
610
+ * @return [Bool]
611
+ */
612
+ static VALUE
613
+ rb_grn_context_force_match_escalation_p (VALUE self)
614
+ {
615
+ return CBOOL2RVAL(grn_ctx_get_force_match_escalation(SELF(self)));
616
+ }
617
+
618
+ /*
619
+ * @overload force_match_escalation=(force_match_escalation)
620
+ */
621
+ static VALUE
622
+ rb_grn_context_set_force_match_escalation (VALUE self, VALUE force_match_escalation)
623
+ {
624
+ grn_ctx_set_force_match_escalation(SELF(self),
625
+ RVAL2CBOOL(force_match_escalation));
626
+ return force_match_escalation;
627
+ }
628
+
607
629
  /*
608
630
  * このコンテキストを使って検索したときに検索の挙動をエスカレー
609
631
  * ションする閾値を返します。
@@ -1039,6 +1061,11 @@ rb_grn_init_context (VALUE mGrn)
1039
1061
  rb_define_method(cGrnContext, "encoding=", rb_grn_context_set_encoding, 1);
1040
1062
  rb_define_method(cGrnContext, "ruby_encoding",
1041
1063
  rb_grn_context_get_ruby_encoding, 0);
1064
+
1065
+ rb_define_method(cGrnContext, "force_match_escalation?",
1066
+ rb_grn_context_force_match_escalation_p, 0);
1067
+ rb_define_method(cGrnContext, "force_match_escalation=",
1068
+ rb_grn_context_set_force_match_escalation, 1);
1042
1069
  rb_define_method(cGrnContext, "match_escalation_threshold",
1043
1070
  rb_grn_context_get_match_escalation_threshold, 0);
1044
1071
  rb_define_method(cGrnContext, "match_escalation_threshold=",