rroonga 4.0.5 → 4.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/benchmark/common.rb +4 -4
  4. data/benchmark/create-wikipedia-database.rb +5 -5
  5. data/benchmark/read-write-many-small-items.rb +8 -8
  6. data/benchmark/repeat-load.rb +4 -4
  7. data/benchmark/select.rb +9 -9
  8. data/benchmark/write-many-small-items.rb +8 -8
  9. data/doc/images/sample-schema.png +0 -0
  10. data/doc/text/install.textile +2 -2
  11. data/doc/text/news.textile +41 -0
  12. data/doc/text/tutorial.textile +4 -4
  13. data/example/bookmark.rb +6 -7
  14. data/example/index-html.rb +6 -6
  15. data/ext/groonga/extconf.rb +23 -1
  16. data/ext/groonga/rb-grn-column.c +3 -2
  17. data/ext/groonga/rb-grn-context.c +20 -3
  18. data/ext/groonga/rb-grn-double-array-trie.c +11 -2
  19. data/ext/groonga/rb-grn-exception.c +28 -10
  20. data/ext/groonga/rb-grn-expression.c +78 -0
  21. data/ext/groonga/rb-grn-hash.c +10 -0
  22. data/ext/groonga/rb-grn-logger.c +7 -3
  23. data/ext/groonga/rb-grn-object.c +3 -2
  24. data/ext/groonga/rb-grn-patricia-trie.c +23 -20
  25. data/ext/groonga/rb-grn-table-key-support.c +92 -1
  26. data/ext/groonga/rb-grn-table.c +60 -17
  27. data/ext/groonga/rb-grn-utils.c +51 -2
  28. data/ext/groonga/rb-grn-variable-size-column.c +11 -7
  29. data/ext/groonga/rb-grn.h +11 -1
  30. data/lib/groonga/dumper.rb +23 -1
  31. data/lib/groonga/patricia-trie.rb +1 -1
  32. data/lib/groonga/schema.rb +190 -205
  33. data/misc/grnop2ruby.rb +1 -1
  34. data/rroonga-build.rb +3 -3
  35. data/rroonga.gemspec +1 -0
  36. data/test/groonga-test-utils.rb +2 -2
  37. data/test/test-column.rb +19 -0
  38. data/test/test-context.rb +5 -1
  39. data/test/test-double-array-trie.rb +19 -0
  40. data/test/test-exception.rb +7 -2
  41. data/test/test-expression.rb +19 -0
  42. data/test/test-fix-size-column.rb +49 -36
  43. data/test/test-hash.rb +22 -0
  44. data/test/test-patricia-trie.rb +26 -7
  45. data/test/test-schema-dumper.rb +65 -1
  46. data/test/test-schema.rb +13 -2
  47. data/test/test-variable-size-column.rb +6 -5
  48. metadata +47 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 503d0a50ec18bb2f348918e9604d3d741789b742
4
- data.tar.gz: e22349e0fc515632567417b2ac6a1da1d026a0ff
3
+ metadata.gz: 0e374f62d1dc60540f41658d346241ed699fb853
4
+ data.tar.gz: a41b8257c7716190ea709d516fd34e4229c36c38
5
5
  SHA512:
6
- metadata.gz: a50ee57fe8bad9362b36745e062026045e019784a87fc23c45f157ed4d1c618b890939b112f484315ee8f24379604a2f77f9ac38569cd92e5a3167c2c9ff34c2
7
- data.tar.gz: 5038e0c3e321b54d00e8675727cbde1dd6a2590f1a30d9b82f86c725e54cbc98b991a014a10fdd9b8b8b6f425a83bf98e3863c8a73f5ebd1c0218e4844df6a09
6
+ metadata.gz: 325d4a719363ba06a78c9e8109926b6312d2f677650f85b242d889c7b2145963323e4c5c347e691c75f0c917bbb32c74513401eae7fc0220050efa0dcaa50515
7
+ data.tar.gz: aecc0398616ba0b886db0eae9bba0599af1d414f2a70be4c79139a2402aaedae9966b600033559c7509328324637e5ab4642af44e8bab86a6155963caa424123
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --output-dir doc/reference/en
2
- --markup textile
2
+ --markup markdown
3
3
  lib/**/*.rb
4
4
  ext/**/*.c
5
5
  -
@@ -1,7 +1,7 @@
1
- require 'benchmark'
2
- require 'tempfile'
1
+ require "benchmark"
2
+ require "tempfile"
3
3
 
4
- def memory_usage()
4
+ def memory_usage
5
5
  status = `cat /proc/#{$$}/status`
6
6
  lines = status.split("\n")
7
7
  lines.each do |line|
@@ -10,7 +10,7 @@ def memory_usage()
10
10
  return line.to_i / 1024.0
11
11
  end
12
12
  end
13
- return -1;
13
+ return -1
14
14
  end
15
15
 
16
16
  @items = []
@@ -1,10 +1,10 @@
1
1
  # Wikipedia data: http://download.wikimedia.org/jawiki/latest/jawiki-latest-pages-articles.xml.bz2
2
2
 
3
- require 'time'
4
- require 'fileutils'
5
- require 'groonga'
3
+ require "time"
4
+ require "fileutils"
5
+ require "groonga"
6
6
 
7
- require 'nokogiri'
7
+ require "nokogiri"
8
8
 
9
9
  class WikipediaExtractor
10
10
  def initialize(listener)
@@ -200,7 +200,7 @@ class GroongaLoader
200
200
  def load_links(title, content)
201
201
  links = content.scan(/\[\[.*?\]\]/)
202
202
  links = links.collect do |link|
203
- link.sub(/\A\[\[/, '').sub(/\]\]\z/, '').sub(/\|[^\|]+\z/, '')
203
+ link.sub(/\A\[\[/, "").sub(/\]\]\z/, "").sub(/\|[^\|]+\z/, "")
204
204
  end
205
205
  @documents.add(title, :links => links)
206
206
  end
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # This benchmark is based on Tokyo Cabinet's benchmark at
4
4
  # http://alpha.mixi.co.jp/blog/?p=791
@@ -52,7 +52,7 @@ begin
52
52
  $LOAD_PATH.unshift(File.join(base_dir, "ext", "groonga"))
53
53
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
54
54
 
55
- require 'groonga'
55
+ require "groonga"
56
56
  tmp_dir = "/tmp/groonga"
57
57
  FileUtils.rm_rf(tmp_dir)
58
58
  FileUtils.mkdir(tmp_dir)
@@ -93,7 +93,7 @@ rescue LoadError
93
93
  end
94
94
 
95
95
  begin
96
- require 'localmemcache'
96
+ require "localmemcache"
97
97
 
98
98
  LocalMemCache.drop(:namespace => "read-write-many-small-items",
99
99
  :force => true)
@@ -108,9 +108,9 @@ rescue LoadError
108
108
  end
109
109
 
110
110
  begin
111
- require 'tokyocabinet'
111
+ require "tokyocabinet"
112
112
 
113
- tc_hash_memory = TokyoCabinet::ADB::new
113
+ tc_hash_memory = TokyoCabinet::ADB.new
114
114
  tc_hash_memory.open("*#bnum=#{n}#mode=wct#xmsiz=0")
115
115
  item("TC: Hash: memory") do
116
116
  values.each do |value|
@@ -119,7 +119,7 @@ begin
119
119
  end
120
120
  end
121
121
 
122
- tc_tree_memory = TokyoCabinet::ADB::new
122
+ tc_tree_memory = TokyoCabinet::ADB.new
123
123
  tc_tree_memory.open("+#bnum=#{n}#mode=wct#xmsiz=0")
124
124
  item("TC: Tree: memory") do
125
125
  values.each do |value|
@@ -129,7 +129,7 @@ begin
129
129
  end
130
130
 
131
131
  hash_file = Tempfile.new(["tc-hash", ".tch"])
132
- tc_hash_file = TokyoCabinet::ADB::new
132
+ tc_hash_file = TokyoCabinet::ADB.new
133
133
  tc_hash_file.open("#{hash_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
134
134
  item("TC: Hash: file") do
135
135
  values.each do |value|
@@ -139,7 +139,7 @@ begin
139
139
  end
140
140
 
141
141
  tree_file = Tempfile.new(["tc-tree", ".tcb"])
142
- tc_tree_file = TokyoCabinet::ADB::new
142
+ tc_tree_file = TokyoCabinet::ADB.new
143
143
  tc_tree_file.open("#{tree_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
144
144
  item("TC: Tree: file") do
145
145
  values.each do |value|
@@ -1,10 +1,10 @@
1
- require 'fileutils'
2
- require 'shellwords'
1
+ require "fileutils"
2
+ require "shellwords"
3
3
 
4
- require 'groonga'
4
+ require "groonga"
5
5
 
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'create-wikipedia-database'
7
+ require "create-wikipedia-database"
8
8
 
9
9
  class SampleRecords
10
10
  def initialize(record_count)
@@ -1,10 +1,10 @@
1
- #encoding: UTF-8
1
+ # -*- coding: utf-8 -*-
2
2
 
3
- require 'benchmark'
4
- require 'shellwords'
5
- require 'optparse'
3
+ require "benchmark"
4
+ require "shellwords"
5
+ require "optparse"
6
6
 
7
- require 'groonga'
7
+ require "groonga"
8
8
 
9
9
  Groonga::Logger.query_log_path = "/tmp/query.log"
10
10
 
@@ -17,7 +17,7 @@ module ColumnTokenizer
17
17
  end
18
18
  tokens.each do |token|
19
19
  unless token == "*"
20
- token.sub!(/[^A-Za-z0-9_]\z/, '')
20
+ token.sub!(/[^A-Za-z0-9_]\z/, "")
21
21
  end
22
22
  end
23
23
  end
@@ -217,7 +217,7 @@ class Query
217
217
  end
218
218
 
219
219
  def to_parameter_symbol(name)
220
- name.sub(NAMED_PARAMETER_PREFIX, '').to_sym
220
+ name.sub(NAMED_PARAMETER_PREFIX, "").to_sym
221
221
  end
222
222
 
223
223
  def create_query
@@ -383,7 +383,7 @@ class SelectorByMethod < Selector
383
383
  tokens = tokenize_column_list(sort_by)
384
384
 
385
385
  tokens.collect do |token|
386
- key = token.sub(DESCENDING_ORDER_PREFIX, '')
386
+ key = token.sub(DESCENDING_ORDER_PREFIX, "")
387
387
  if token =~ DESCENDING_ORDER_PREFIX
388
388
  descending_order_sort_key(key)
389
389
  else
@@ -493,7 +493,7 @@ class SelectorByMethod < Selector
493
493
  columns = columns.collect do |column|
494
494
  if column == "*"
495
495
  table.columns.collect(&:name).collect do |name|
496
- name.sub(/\A[A-Za-z0-9_]+\./, '')
496
+ name.sub(/\A[A-Za-z0-9_]+\./, "")
497
497
  end
498
498
  else
499
499
  column if column_included_in_record?(column, result.first)
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # This benchmark is based on Tokyo Cabinet's benchmark at
4
4
  # http://alpha.mixi.co.jp/blog/?p=791
@@ -51,7 +51,7 @@ begin
51
51
  $LOAD_PATH.unshift(File.join(base_dir, "ext", "groonga"))
52
52
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
53
53
 
54
- require 'groonga'
54
+ require "groonga"
55
55
  tmp_dir = "/tmp/groonga"
56
56
  FileUtils.rm_rf(tmp_dir)
57
57
  FileUtils.mkdir(tmp_dir)
@@ -89,7 +89,7 @@ rescue LoadError
89
89
  end
90
90
 
91
91
  begin
92
- require 'localmemcache'
92
+ require "localmemcache"
93
93
 
94
94
  LocalMemCache.drop(:namespace => "write-many-small-items", :force => true)
95
95
  mem_cache = LocalMemCache.new(:namespace => "write-many-small-items")
@@ -102,9 +102,9 @@ rescue LoadError
102
102
  end
103
103
 
104
104
  begin
105
- require 'tokyocabinet'
105
+ require "tokyocabinet"
106
106
 
107
- tc_hash_memory = TokyoCabinet::ADB::new
107
+ tc_hash_memory = TokyoCabinet::ADB.new
108
108
  tc_hash_memory.open("*#bnum=#{n}#mode=wct#xmsiz=0")
109
109
  item("TC: Hash: memory") do
110
110
  values.each do |value|
@@ -112,7 +112,7 @@ begin
112
112
  end
113
113
  end
114
114
 
115
- tc_tree_memory = TokyoCabinet::ADB::new
115
+ tc_tree_memory = TokyoCabinet::ADB.new
116
116
  tc_tree_memory.open("+#bnum=#{n}#mode=wct#xmsiz=0")
117
117
  item("TC: Tree: memory") do
118
118
  values.each do |value|
@@ -121,7 +121,7 @@ begin
121
121
  end
122
122
 
123
123
  hash_file = Tempfile.new(["tc-hash", ".tch"])
124
- tc_hash_file = TokyoCabinet::ADB::new
124
+ tc_hash_file = TokyoCabinet::ADB.new
125
125
  tc_hash_file.open("#{hash_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
126
126
  item("TC: Hash: file") do
127
127
  values.each do |value|
@@ -130,7 +130,7 @@ begin
130
130
  end
131
131
 
132
132
  tree_file = Tempfile.new(["tc-tree", ".tcb"])
133
- tc_tree_file = TokyoCabinet::ADB::new
133
+ tc_tree_file = TokyoCabinet::ADB.new
134
134
  tc_tree_file.open("#{tree_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
135
135
  item("TC: Tree: file") do
136
136
  values.each do |value|
@@ -2,7 +2,7 @@ h1. Install
2
2
 
3
3
  This document describes how to install Rroonga.
4
4
 
5
- You can install Rrroonga by RubyGems. It is the standard way for Ruby
5
+ You can install Rroonga by RubyGems. It is the standard way for Ruby
6
6
  libraries.
7
7
 
8
8
  Rroonga is depends on Groonga. So you need to install both Groonga and
@@ -48,7 +48,7 @@ Type the following command on Ruby console:
48
48
 
49
49
  <pre>
50
50
  !!!command_line
51
- % gem.bat install rroonga
51
+ > gem install rroonga
52
52
  </pre>
53
53
 
54
54
  This document assumes that you're using "RubyInstaller for
@@ -1,5 +1,46 @@
1
1
  h1. NEWS
2
2
 
3
+ h2(#4-0-6). 4.0.6: 2014-11-06
4
+
5
+ h3. Improvements
6
+
7
+ * Supported Groonga 4.0.7. [GitHub#28]
8
+ ** Changed {Groonga::Context#support_lzo?} always returns @false@.
9
+ ** Added {Groonga::Context#support_lz4?}.
10
+ ** Supported @:lz4@ in {Groonga::Table#define_column} options.
11
+ ** Supported @:lz4@ in {Groonga::VariableSizeColumn#compressed?} options.
12
+ ** Added {Groonga::LZ4Error}.
13
+ ** [grndump] Supported @COMPRESS_ZLIB@ and @COMPRESS_LZ4@ flags.
14
+ ** Added {Groonga::TableKeySupport#token_filters}.
15
+ ** Added {Groonga::TableKeySupport#token_filters=}.
16
+ ** Supported @:token_filters@ in {Groonga::Hash.create} options.
17
+ ** Supported @:token_filters@ in {Groonga::PatriciaTrie.create} options.
18
+ ** Supported @:token_filters@ in {Groonga::DoubleArrayTrie.create} options.
19
+ ** Supported @:token_filters@ in {Groonga::Schema.create_table} options.
20
+ ** Added {Groonga::TokenFilterError}.
21
+ ** [grndump] Supported token filters.
22
+ * Added {Groonga::Expression#keywords}. [GitHub#30]
23
+ * Stopped to require logger object as the first argument of
24
+ {Groonga::Logger.register} when block is specified.
25
+
26
+ h3. Fixes
27
+
28
+ * [doc] Removed deprecated example.
29
+ [GitHub#26] [Patch by ongaeshi]
30
+ * Fixed a bug that a column assignment raises an error when
31
+ you assign value with type A and then assign value type B again.
32
+ [GitHub#27] [Patch by Daisuke Goto]
33
+ * Fixed a memory leak in {Groonga::PatriciaTrie#open_near_cursor}.
34
+ * Fixed a bug that you can access a column renamed by
35
+ {Groonga::Column#rename} with old name.
36
+ [GitHub#29] [Patch by Daisuke Goto]
37
+ * [doc] Fixed wrong option name of {Groonga::Logger.register}.
38
+
39
+ h3. Thanks
40
+
41
+ * ongaeshi
42
+ * Daisuke Goto
43
+
3
44
  h2(#4-0-5). 4.0.5: 2014-10-05
4
45
 
5
46
  h3. Improvements
@@ -1,10 +1,10 @@
1
1
  h1. Tutorial
2
2
 
3
- This page introduce how to use rroonga via a simple application making.
3
+ This page introduce how to use Rroonga via a simple application making.
4
4
 
5
5
  h2. Install
6
6
 
7
- You can install rroonga in your compter with RubyGems.
7
+ You can install Rroonga in your compter with RubyGems.
8
8
 
9
9
  <pre>
10
10
  !!!command_line
@@ -14,11 +14,11 @@ You can install rroonga in your compter with RubyGems.
14
14
  h2. Create Database
15
15
 
16
16
  Let's create database for simple bookmark application.
17
- Please execute irb with loading rroonga with this command:
17
+ Please execute irb with loading Rroonga with this command:
18
18
 
19
19
  <pre>
20
20
  !!!irb
21
- % irb --simple-prompt -rubygems -rgroonga
21
+ % irb --simple-prompt -r groonga
22
22
  >>
23
23
  </pre>
24
24
 
@@ -2,8 +2,8 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  base_dir = File.join(File.dirname(__FILE__), "..")
5
- groonga_ext_dir = File.join(base_dir, 'ext', 'groonga')
6
- groonga_lib_dir = File.join(base_dir, 'lib')
5
+ groonga_ext_dir = File.join(base_dir, "ext", "groonga")
6
+ groonga_lib_dir = File.join(base_dir, "lib")
7
7
  $LOAD_PATH.unshift(groonga_ext_dir)
8
8
  $LOAD_PATH.unshift(groonga_lib_dir)
9
9
 
@@ -14,19 +14,18 @@ rescue LoadError
14
14
  require "groonga"
15
15
  end
16
16
 
17
- require 'time'
17
+ require "time"
18
18
 
19
19
  # Groonga::Logger.register(:level => :debug) do |level, time, title, message, location|
20
20
  # p [level, time, title, message, location]
21
21
  # end
22
22
 
23
- $KCODE = "UTF-8"
24
23
  Groonga::Context.default_options = {:encoding => :utf8}
25
24
 
26
25
  path = ARGV[0]
27
26
  if path.nil?
28
- require 'tmpdir'
29
- require 'fileutils'
27
+ require "tmpdir"
28
+ require "fileutils"
30
29
  temporary_directory = File.join(Dir.tmpdir, "rroonga")
31
30
  FileUtils.mkdir_p(temporary_directory)
32
31
  at_exit {FileUtils.rm_rf(temporary_directory)}
@@ -112,7 +111,7 @@ p(add_bookmark("http://jp.rubyist.net/magazine/",
112
111
  "Rubyist Magazine - るびま", "moritan", "Ruby 記事",
113
112
  Time.parse("2010-10-07T14:18:28+09:00")))
114
113
  p(add_bookmark("http://groonga.rubyforge.org/",
115
- "Rubyでgroonga使って全文検索 - ラングバ", "taporobo",
114
+ "RubyでGroonga使って全文検索 - ラングバ", "taporobo",
116
115
  "Ruby groonga 全文検索",
117
116
  Time.parse("2010-11-11T12:39:59+09:00")))
118
117
  p(add_bookmark("http://www.rubyist.net/~matz/",
@@ -5,15 +5,15 @@ if ARGV.size < 2 or ARGV.find {|option| option == "-h" or option == "--help"}
5
5
  exit
6
6
  end
7
7
 
8
- require 'pathname'
8
+ require "pathname"
9
9
 
10
10
  base_directory = Pathname(__FILE__).dirname + ".."
11
11
  $LOAD_PATH.unshift((base_directory + "ext").to_s)
12
12
  $LOAD_PATH.unshift((base_directory + "lib").to_s)
13
13
 
14
- require 'rubygems'
15
- require 'groonga'
16
- require 'nokogiri'
14
+ require "rubygems"
15
+ require "groonga"
16
+ require "nokogiri"
17
17
 
18
18
  database_file, *targets = ARGV
19
19
 
@@ -71,8 +71,8 @@ targets.each do |target|
71
71
  end
72
72
  html_document.css("img").each do |image|
73
73
  image_content = []
74
- title = image['title']
75
- alt = image['alt']
74
+ title = image["title"]
75
+ alt = image["alt"]
76
76
  image_content << title if title and !title.empty?
77
77
  image_content << alt if alt and !alt.empty?
78
78
  contents.concat(image_content) unless image_content.empty?
@@ -167,11 +167,22 @@ def configure_command_line(prefix)
167
167
  escaped_command_line.join(" ")
168
168
  end
169
169
 
170
+ def n_processors
171
+ proc_file = "/proc/cpuinfo"
172
+ if File.exist?(proc_file)
173
+ File.readlines(proc_file).grep(/^processor/).size
174
+ elsif /darwin/ =~ RUBY_PLATFORM
175
+ `sysctl -n hw.ncpu`.to_i
176
+ else
177
+ 1
178
+ end
179
+ end
180
+
170
181
  def install_for_gnu_build_system(install_dir)
171
182
  run_command("configuring...",
172
183
  configure_command_line(install_dir))
173
184
  run_command("building (maybe long time)...",
174
- "make")
185
+ "make -j#{n_processors}")
175
186
  run_command("installing...",
176
187
  "make install")
177
188
  end
@@ -272,6 +283,9 @@ have_func("rb_sym2str", "ruby.h")
272
283
  have_func("rb_to_symbol", "ruby.h")
273
284
  have_type("enum ruby_value_type", "ruby.h")
274
285
 
286
+ # TODO: Remove me after Groogna 4.0.8 is released.
287
+ have_func("grn_expr_dump_plan", "groonga.h")
288
+
275
289
  checking_for(checking_message("--enable-debug-log option")) do
276
290
  enable_debug_log = enable_config("debug-log", false)
277
291
  if enable_debug_log
@@ -313,6 +327,14 @@ checking_for(checking_message("--enable-debug-build option")) do
313
327
  enable_debug_build
314
328
  end
315
329
 
330
+ checking_for(checking_message("--enable-untyped-data-warning option")) do
331
+ enable_check_untyped_data = enable_config("untyped-data-warning", false)
332
+ if enable_check_untyped_data
333
+ $defs << "-DRUBY_UNTYPED_DATA_WARNING"
334
+ end
335
+ enable_check_untyped_data
336
+ end
337
+
316
338
  if ENV["INSTALL_RB"] == "yes"
317
339
  $INSTALLFILES ||= []
318
340
  $INSTALLFILES << ["../../lib/**/*.rb", "$(RUBYLIBDIR)", "../../lib"]