rroonga 9.0.3 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Rakefile +26 -135
  4. data/doc/text/news.md +79 -1
  5. data/doc/text/tutorial.md +1 -1
  6. data/ext/groonga/extconf.rb +19 -74
  7. data/ext/groonga/rb-grn-accessor.c +2 -2
  8. data/ext/groonga/rb-grn-column-cache.c +3 -3
  9. data/ext/groonga/rb-grn-column.c +4 -4
  10. data/ext/groonga/rb-grn-context.c +109 -58
  11. data/ext/groonga/rb-grn-data-column.c +4 -4
  12. data/ext/groonga/rb-grn-database.c +45 -26
  13. data/ext/groonga/rb-grn-double-array-trie.c +2 -2
  14. data/ext/groonga/rb-grn-encoding-support.c +2 -2
  15. data/ext/groonga/rb-grn-exception.c +14 -0
  16. data/ext/groonga/rb-grn-expression-builder.c +3 -3
  17. data/ext/groonga/rb-grn-expression.c +3 -3
  18. data/ext/groonga/rb-grn-fix-size-column.c +2 -2
  19. data/ext/groonga/rb-grn-flushable.c +9 -1
  20. data/ext/groonga/rb-grn-hash.c +2 -2
  21. data/ext/groonga/rb-grn-index-column.c +30 -2
  22. data/ext/groonga/rb-grn-index-cursor.c +21 -2
  23. data/ext/groonga/rb-grn-inverted-index-cursor.c +3 -3
  24. data/ext/groonga/rb-grn-logger.c +17 -3
  25. data/ext/groonga/rb-grn-object.c +266 -31
  26. data/ext/groonga/rb-grn-operator.c +100 -259
  27. data/ext/groonga/rb-grn-patricia-trie.c +2 -2
  28. data/ext/groonga/rb-grn-plugin.c +34 -22
  29. data/ext/groonga/rb-grn-request-timer-id.c +2 -2
  30. data/ext/groonga/rb-grn-snippet.c +3 -3
  31. data/ext/groonga/rb-grn-table-cursor-key-support.c +2 -2
  32. data/ext/groonga/rb-grn-table-cursor.c +3 -3
  33. data/ext/groonga/rb-grn-table-key-support.c +28 -9
  34. data/ext/groonga/rb-grn-table.c +180 -130
  35. data/ext/groonga/rb-grn-type.c +5 -1
  36. data/ext/groonga/rb-grn-utils.c +17 -1
  37. data/ext/groonga/rb-grn-variable-size-column.c +2 -2
  38. data/ext/groonga/rb-grn-variable.c +2 -2
  39. data/ext/groonga/rb-grn.h +11 -14
  40. data/ext/groonga/rb-groonga.c +6 -2
  41. data/lib/groonga.rb +3 -7
  42. data/lib/groonga/context.rb +32 -0
  43. data/lib/groonga/dumper.rb +3 -0
  44. data/lib/groonga/record.rb +2 -2
  45. data/rroonga-build.rb +5 -4
  46. data/rroonga.gemspec +8 -6
  47. data/test/groonga-test-utils.rb +37 -5
  48. data/test/run-test.rb +1 -3
  49. data/test/test-accessor.rb +63 -7
  50. data/test/test-column.rb +12 -1
  51. data/test/test-context.rb +25 -0
  52. data/test/test-exception.rb +5 -0
  53. data/test/test-flushable.rb +51 -6
  54. data/test/test-index-column.rb +70 -9
  55. data/test/test-index-cursor.rb +26 -0
  56. data/test/test-logger.rb +56 -11
  57. data/test/test-plugin.rb +1 -0
  58. data/test/test-query-logger.rb +4 -3
  59. data/test/test-ractor.rb +65 -0
  60. data/test/test-record.rb +2 -1
  61. data/test/test-remote.rb +58 -10
  62. data/test/test-schema-dumper.rb +13 -0
  63. data/test/test-schema.rb +9 -1
  64. data/test/test-table-arrow.rb +22 -10
  65. data/test/test-table.rb +21 -1
  66. data/test/test-variable.rb +23 -7
  67. metadata +72 -97
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d57c8009b0208e7e7a664d88571dd572d1c57854eaacf642447370a46eb4b0ca
4
- data.tar.gz: dd1bbbf57c0625903acddf7bcefea6b1bf6d25b11250030b4e73e67964de0750
3
+ metadata.gz: d2e5c28e453fae2876164e7ea4ef8e3e24b0e789bec2c6cd270850905296a9c5
4
+ data.tar.gz: 8f8cac4d824bc94e0f89dd8ee60e8b2a0fd0fb92b1e666dfbb7732ef43c7bb96
5
5
  SHA512:
6
- metadata.gz: 1670c187030094b149c0519a691ec08955b4b0ec5ebad06e32b3356dfae8cfdfcafcf2b4dfea261524b2273089f764f8e619582dab065906919ccfc23e3f2809
7
- data.tar.gz: b10932d7b251953142d3d1ad25faeadc4ce37a408009aaad6f1927e9d1ae20edba8e0cafe4ff494c05805449d5c4df8d235a338ae5454126e559bd1101eda883
6
+ metadata.gz: e23a7b4d5aaa7375ee7347fdce6706d90311f8447ec41d7ecf7d0864258f9992cbba7a9521d5afd5589197a25e3b3acece7c7c515ecfb2980daa8329639a678b
7
+ data.tar.gz: cefd86c0fc0053aa34d669b4cb94f78d38dc63ee4faea9c32b1a5519fc231f99bc1146e8f54bb50d38a60d89e1129a7e5145bc03107f05cf3925cd8687cf98fa
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,74 +63,38 @@ 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.3.0:2.4.0:2.5.0:2.6.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
77
+ def update_version(new_version)
78
+ splitted_new_version = new_version.split(".")
79
+ type_order = ["MAJOR", "MINOR", "MICRO"]
80
+ File.open("ext/groonga/rb-grn.h", "rb+") do |rb_grn_h|
81
+ content = rb_grn_h.read
82
+ content.gsub!(/(RB_GRN_(MAJOR|MINOR|MICRO)_VERSION) \d+/) do
83
+ name = $1
84
+ type = $2
85
+ "#{name} #{splitted_new_version[type_order.index(type)]}"
191
86
  end
87
+ rb_grn_h.rewind
88
+ rb_grn_h.write(content)
192
89
  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
90
  end
200
91
 
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
92
+ namespace :version do
93
+ desc "Update version"
94
+ task :update do |_, args|
95
+ new_version = ENV["NEW_VERSION"]
96
+ raise "NEW_VERSION must be specified" if new_version.nil?
97
+ update_version(new_version)
207
98
  end
208
99
  end
209
100
 
data/doc/text/news.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # NEWS
2
2
 
3
+ ## 11.0.0: 2021-02-09 {#version-11-0-0}
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::ConnectionReset} Added.
8
+
9
+ * {Groonga::Context.open} Added.
10
+
11
+ * Added support for Ractor.
12
+
13
+ * {Groonga::Database} Accept path like object in .open/.create.
14
+
15
+ ## 10.0.6: 2020-09-01 {#version-10-0-6}
16
+
17
+ ### Fixes
18
+
19
+ * Fixed a bug that failed `gem install rroonga` in Windows version.
20
+
21
+ ## 10.0.2: 2020-04-29 {#version-10-0-2}
22
+
23
+ ### Improvements
24
+
25
+ * Added support for Float32 in Groonga 10.0.2.
26
+
27
+ * [doc] Fixed markup of a image in tutorial [GitHub#192][Patched by takahashim]
28
+
29
+ ### Thanks
30
+
31
+ * takahashim
32
+
33
+ ## 10.0.1: 2020-04-02 {#version-10-0-1}
34
+
35
+ ### Improvements
36
+
37
+ * Added support for creating a table with normalizer with options
38
+
39
+ * Windows: Added Ruby 2.7 support.
40
+
41
+ * Windows: Dropped Ruby 2.3.
42
+
43
+ * This version has been EOL.
44
+
45
+ * Dropped fat gem support.
46
+
47
+ ## 9.0.7: 2019-08-29 {#version-9-0-7}
48
+
49
+ ### Improvements
50
+
51
+ * {Groonga::Object#lexicon?} Added.
52
+
53
+ * {Groonga::IndexColumn} Added support "INDEX_LARGE".
54
+
55
+ * {Groonga::IndexCursor#set_min?} Added.
56
+
57
+ * {Groonga::IndexCursor#set_min=} Added.
58
+
59
+ * {Groonga::Context#force_match_escalation?} Added.
60
+
61
+ * {Groonga::Context#force_match_escalation=} Added.
62
+
63
+ * {Groonga::Object#id_accessor?} Added.
64
+
65
+ * {Groonga::Logger.flags} Added support for thread id option.
66
+
67
+ * {Groonga::Object#bulk?} Added.
68
+
69
+ * {Groonga::Object#value_accessor?} Added.
70
+
71
+ * {Groonga::Table} Delegate support_score? from Groonga::Record to Groonga::Table.
72
+
73
+ * Groonga::Flashable Added support dependent option.
74
+
75
+ * {Groonga::Object#score_accessor?} Added.
76
+
77
+ * {Groonga::Object#nsubrecs_accessor? } Added.
78
+
79
+ * Translate a part of explanation of Groonga::Table into English.
80
+
3
81
  ## 9.0.3: 2019-05-10 {#version-9-0-3}
4
82
 
5
83
  ### Improvements
@@ -15,7 +93,7 @@
15
93
  * Added support for "--with-groonga-configure-options".
16
94
  [GitHub#146][Reported by Tomás Pollak]
17
95
 
18
- * {Groonga::RegexpExpressionBuilder}: Added support (?-mix:XXX) for searching of regular expression.
96
+ * Groonga::RegexpExpressionBuilder: Added support (?-mix:XXX) for searching of regular expression.
19
97
  [groonga-dev,04694][Reported by Masatoshi SEKI]
20
98
 
21
99
  * Use "groonga-latest.tar.gz" for build Groonga.
data/doc/text/tutorial.md CHANGED
@@ -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-2021 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
@@ -23,6 +23,7 @@ require "shellwords"
23
23
  require "open-uri"
24
24
  require "uri"
25
25
 
26
+ require "native-package-installer"
26
27
  require "pkg-config"
27
28
 
28
29
  base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
@@ -49,30 +50,11 @@ def win32?
49
50
  /cygwin|mingw|mswin/ =~ RUBY_PLATFORM
50
51
  end
51
52
 
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
53
  def install_groonga_locally
68
54
  FileUtils.mkdir_p(local_groonga_base_dir)
69
55
 
70
56
  Dir.chdir(local_groonga_base_dir) do
71
- if win32?
72
- extract_groonga_win32_binary
73
- else
74
- build_groonga
75
- end
57
+ build_groonga
76
58
  end
77
59
 
78
60
  prepend_pkg_config_path_for_local_groonga
@@ -96,7 +78,7 @@ def download(url)
96
78
  ]
97
79
  end
98
80
  end
99
- open(url, "rb", options) do |input|
81
+ URI.open(url, "rb", *options) do |input|
100
82
  File.open(base_name, "wb") do |output|
101
83
  while (buffer = input.read(1024))
102
84
  output.print(buffer)
@@ -107,50 +89,6 @@ def download(url)
107
89
  end
108
90
  end
109
91
 
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
92
  def run_command(start_message, command)
155
93
  message(start_message)
156
94
  if xsystem(command)
@@ -247,6 +185,7 @@ def build_groonga_from_tar_gz
247
185
  FileUtils.mkdir_p(groonga_source_dir)
248
186
 
249
187
  message("extracting...")
188
+ # TODO: Use Zlip::GzipReader and Gem::Package::TarReader
250
189
  if xsystem("tar xfz #{tar_gz} -C #{groonga_source_dir} --strip-components=1")
251
190
  message(" done\n")
252
191
  else
@@ -285,15 +224,18 @@ def install_local_groonga(package_name, major, minor, micro)
285
224
  add_rpath_for_local_groonga
286
225
  end
287
226
 
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)
227
+ need_auto_groonga_install = false
228
+ unless PKGConfig.have_package(package_name, major, minor, micro)
229
+ if NativePackageInstaller.install(debian: "libgroonga-dev",
230
+ homebrew: "groonga",
231
+ msys2: "groonga")
232
+ need_auto_groonga_install =
233
+ !PKGConfig.have_package(package_name, major, minor, micro)
295
234
  end
296
235
  end
236
+ if need_auto_groonga_install
237
+ install_local_groonga(package_name, major, minor, micro)
238
+ end
297
239
 
298
240
  real_version = PKGConfig.modversion(package_name)
299
241
  real_major, real_minor, real_micro = real_version.split(/\./)
@@ -335,7 +277,7 @@ end
335
277
 
336
278
  def enable_debug_build_flag(flags)
337
279
  if gcc?
338
- flags.gsub(/(^|\s)?-g\d?(\s|$)?/, '\\1-ggdb3\\2')
280
+ flags.gsub(/(^|\s)?-g\d?(\s|$)/, '\\1-ggdb3\\2')
339
281
  else
340
282
  flags
341
283
  end
@@ -347,6 +289,9 @@ checking_for(checking_message("--enable-debug-build option")) do
347
289
  $CFLAGS = disable_optimization_build_flag($CFLAGS)
348
290
  $CFLAGS = enable_debug_build_flag($CFLAGS)
349
291
 
292
+ CONFIG["optflags"] = disable_optimization_build_flag(CONFIG["optflags"])
293
+ CONFIG["debugflags"] = enable_debug_build_flag(CONFIG["debugflags"])
294
+
350
295
  CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"])
351
296
  CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"])
352
297
  end