rroonga 3.0.5-x86-mingw32 → 3.0.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/Gemfile +20 -0
- data/Rakefile +187 -0
- data/doc/text/news.textile +7 -0
- data/doc/text/tutorial.textile +0 -2
- data/ext/groonga/extconf.rb +7 -1
- data/ext/groonga/rb-grn-accessor.c +11 -11
- data/ext/groonga/rb-grn-array.c +25 -25
- data/ext/groonga/rb-grn-column.c +106 -106
- data/ext/groonga/rb-grn-context.c +121 -121
- data/ext/groonga/rb-grn-database.c +78 -78
- data/ext/groonga/rb-grn-double-array-trie.c +92 -92
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +28 -28
- data/ext/groonga/rb-grn-exception.c +9 -9
- data/ext/groonga/rb-grn-expression-builder.c +6 -6
- data/ext/groonga/rb-grn-expression.c +87 -87
- data/ext/groonga/rb-grn-fix-size-column.c +12 -12
- data/ext/groonga/rb-grn-geo-point.c +2 -2
- data/ext/groonga/rb-grn-hash.c +38 -38
- data/ext/groonga/rb-grn-index-column.c +191 -191
- data/ext/groonga/rb-grn-index-cursor.c +29 -29
- data/ext/groonga/rb-grn-logger.c +36 -36
- data/ext/groonga/rb-grn-normalizer.c +10 -10
- data/ext/groonga/rb-grn-patricia-trie.c +196 -196
- data/ext/groonga/rb-grn-plugin.c +5 -5
- data/ext/groonga/rb-grn-posting.c +2 -2
- data/ext/groonga/rb-grn-procedure.c +2 -2
- data/ext/groonga/rb-grn-query-logger.c +1 -1
- data/ext/groonga/rb-grn-record.c +1 -1
- data/ext/groonga/rb-grn-snippet.c +14 -14
- data/ext/groonga/rb-grn-table-cursor-key-support.c +4 -4
- data/ext/groonga/rb-grn-table-cursor.c +52 -52
- data/ext/groonga/rb-grn-table-key-support.c +209 -209
- data/ext/groonga/rb-grn-type.c +18 -18
- data/ext/groonga/rb-grn-utils.c +332 -314
- data/ext/groonga/rb-grn-variable-size-column.c +34 -34
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn.h +240 -232
- data/ext/groonga/rb-groonga.c +10 -10
- data/lib/1.9/groonga.so +0 -0
- data/lib/2.0/groonga.so +0 -0
- data/rroonga-build.rb +7 -0
- data/rroonga.gemspec +1 -1
- data/test/test-hash.rb +4 -4
- data/test/test-index-column.rb +271 -257
- data/test/test-table-key-support.rb +78 -0
- data/test/test-table.rb +78 -51
- metadata +8 -3
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class TableKeySupportTest < Test::Unit::TestCase
|
17
|
+
include GroongaTestUtils
|
18
|
+
|
19
|
+
setup :setup_database
|
20
|
+
|
21
|
+
class TypeTest < self
|
22
|
+
def test_int8
|
23
|
+
key = -1
|
24
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "Int8")
|
25
|
+
id = ids.add(key)
|
26
|
+
assert_equal(key, id.key)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_uint8
|
30
|
+
key = 1
|
31
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "UInt8")
|
32
|
+
id = ids.add(key)
|
33
|
+
assert_equal(key, id.key)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_int16
|
37
|
+
key = -(2 ** 8)
|
38
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "Int16")
|
39
|
+
id = ids.add(key)
|
40
|
+
assert_equal(key, id.key)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_uint16
|
44
|
+
key = 2 ** 8
|
45
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "UInt16")
|
46
|
+
id = ids.add(key)
|
47
|
+
assert_equal(key, id.key)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_int32
|
51
|
+
key = -(2 ** 16)
|
52
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "Int32")
|
53
|
+
id = ids.add(key)
|
54
|
+
assert_equal(key, id.key)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_uint32
|
58
|
+
key = 2 ** 16
|
59
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "UInt32")
|
60
|
+
id = ids.add(key)
|
61
|
+
assert_equal(key, id.key)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_int64
|
65
|
+
key = -(2 ** 32)
|
66
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "Int64")
|
67
|
+
id = ids.add(key)
|
68
|
+
assert_equal(key, id.key)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_uint64
|
72
|
+
key = 2 ** 32
|
73
|
+
ids = Groonga::Hash.create(:name => "IDs", :key_type => "UInt64")
|
74
|
+
id = ids.add(key)
|
75
|
+
assert_equal(key, id.key)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/test/test-table.rb
CHANGED
@@ -423,57 +423,6 @@ class TableTest < Test::Unit::TestCase
|
|
423
423
|
sorted_bookmarks.collect(&:value))
|
424
424
|
end
|
425
425
|
|
426
|
-
def test_group
|
427
|
-
bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
428
|
-
bookmarks.define_column("title", "Text")
|
429
|
-
comments = Groonga::Array.create(:name => "Comments")
|
430
|
-
comments.define_column("bookmark", bookmarks)
|
431
|
-
comments.define_column("content", "Text")
|
432
|
-
comments.define_column("issued", "Int32")
|
433
|
-
|
434
|
-
groonga = bookmarks.add("http://groonga.org/", :title => "groonga")
|
435
|
-
ruby = bookmarks.add("http://ruby-lang.org/", :title => "Ruby")
|
436
|
-
|
437
|
-
now = Time.now.to_i
|
438
|
-
comments.add(:bookmark => groonga,
|
439
|
-
:content => "full-text search",
|
440
|
-
:issued => now)
|
441
|
-
comments.add(:bookmark => groonga,
|
442
|
-
:content => "column store",
|
443
|
-
:issued => now)
|
444
|
-
comments.add(:bookmark => ruby,
|
445
|
-
:content => "object oriented script language",
|
446
|
-
:issued => now)
|
447
|
-
|
448
|
-
records = comments.select do |record|
|
449
|
-
record["issued"] > 0
|
450
|
-
end
|
451
|
-
assert_equal([[2, "groonga", "http://groonga.org/"],
|
452
|
-
[1, "Ruby", "http://ruby-lang.org/"]],
|
453
|
-
records.group(".bookmark").collect do |record|
|
454
|
-
bookmark = record.key
|
455
|
-
[record.n_sub_records,
|
456
|
-
bookmark["title"],
|
457
|
-
bookmark.key]
|
458
|
-
end)
|
459
|
-
assert_equal([[2, "groonga", "http://groonga.org/"],
|
460
|
-
[1, "Ruby", "http://ruby-lang.org/"]],
|
461
|
-
records.group(%w".bookmark").collect do |record|
|
462
|
-
bookmark = record.key
|
463
|
-
[record.n_sub_records,
|
464
|
-
bookmark["title"],
|
465
|
-
bookmark.key]
|
466
|
-
end)
|
467
|
-
end
|
468
|
-
|
469
|
-
def test_group_with_unknown_key
|
470
|
-
bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
471
|
-
message = "unknown group key: <\"nonexistent\">: <#{bookmarks.inspect}>"
|
472
|
-
assert_raise(ArgumentError.new(message)) do
|
473
|
-
bookmarks.group("nonexistent")
|
474
|
-
end
|
475
|
-
end
|
476
|
-
|
477
426
|
def test_union!
|
478
427
|
bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
479
428
|
bookmarks.define_column("title", "ShortText")
|
@@ -783,6 +732,84 @@ class TableTest < Test::Unit::TestCase
|
|
783
732
|
groups)
|
784
733
|
end
|
785
734
|
end
|
735
|
+
|
736
|
+
class KeyTest < self
|
737
|
+
setup
|
738
|
+
def setup_schema
|
739
|
+
Groonga::Schema.define do |schema|
|
740
|
+
schema.create_table("Bookmarks", :type => :hash) do |table|
|
741
|
+
table.text("title")
|
742
|
+
end
|
743
|
+
|
744
|
+
schema.create_table("Comments", :type => :array) do |table|
|
745
|
+
table.reference("bookmark")
|
746
|
+
table.text("content")
|
747
|
+
table.int32("rank")
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
setup
|
753
|
+
def setup_data
|
754
|
+
setup_bookmarks
|
755
|
+
setup_comments
|
756
|
+
end
|
757
|
+
|
758
|
+
def setup_bookmarks
|
759
|
+
@bookmarks = Groonga["Bookmarks"]
|
760
|
+
@groonga = @bookmarks.add("http://groonga.org/", :title => "groonga")
|
761
|
+
@ruby = @bookmarks.add("http://ruby-lang.org/", :title => "Ruby")
|
762
|
+
end
|
763
|
+
|
764
|
+
def setup_comments
|
765
|
+
@comments = Groonga["Comments"]
|
766
|
+
@comments.add(:bookmark => @groonga,
|
767
|
+
:content => "full-text search")
|
768
|
+
@comments.add(:bookmark => @groonga,
|
769
|
+
:content => "column store")
|
770
|
+
@comments.add(:bookmark => @ruby,
|
771
|
+
:content => "object oriented script language")
|
772
|
+
end
|
773
|
+
|
774
|
+
def test_string
|
775
|
+
grouped_records = @comments.group("bookmark").collect do |record|
|
776
|
+
bookmark = record.key
|
777
|
+
[
|
778
|
+
record.n_sub_records,
|
779
|
+
bookmark["title"],
|
780
|
+
bookmark.key,
|
781
|
+
]
|
782
|
+
end
|
783
|
+
assert_equal([
|
784
|
+
[2, "groonga", "http://groonga.org/"],
|
785
|
+
[1, "Ruby", "http://ruby-lang.org/"],
|
786
|
+
],
|
787
|
+
grouped_records)
|
788
|
+
end
|
789
|
+
|
790
|
+
def test_array
|
791
|
+
grouped_records = @comments.group(["bookmark"]).collect do |record|
|
792
|
+
bookmark = record.key
|
793
|
+
[
|
794
|
+
record.n_sub_records,
|
795
|
+
bookmark["title"],
|
796
|
+
bookmark.key,
|
797
|
+
]
|
798
|
+
end
|
799
|
+
assert_equal([
|
800
|
+
[2, "groonga", "http://groonga.org/"],
|
801
|
+
[1, "Ruby", "http://ruby-lang.org/"],
|
802
|
+
],
|
803
|
+
grouped_records)
|
804
|
+
end
|
805
|
+
|
806
|
+
def test_nonexistent
|
807
|
+
message = "unknown group key: <\"nonexistent\">: <#{@comments.inspect}>"
|
808
|
+
assert_raise(ArgumentError.new(message)) do
|
809
|
+
@comments.group("nonexistent")
|
810
|
+
end
|
811
|
+
end
|
812
|
+
end
|
786
813
|
end
|
787
814
|
|
788
815
|
class OtherProcessTest < self
|
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: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: pkg-config
|
@@ -212,6 +212,10 @@ extensions: []
|
|
212
212
|
extra_rdoc_files:
|
213
213
|
- README.textile
|
214
214
|
files:
|
215
|
+
- README.textile
|
216
|
+
- AUTHORS
|
217
|
+
- Rakefile
|
218
|
+
- Gemfile
|
215
219
|
- doc/text/tutorial.textile
|
216
220
|
- doc/text/news.textile
|
217
221
|
- rroonga.gemspec
|
@@ -304,6 +308,7 @@ files:
|
|
304
308
|
- test/test-encoding.rb
|
305
309
|
- test/test-schema-create-table.rb
|
306
310
|
- test/test-type.rb
|
311
|
+
- test/test-table-key-support.rb
|
307
312
|
- test/test-database.rb
|
308
313
|
- test/test-variable.rb
|
309
314
|
- test/test-table-select.rb
|
@@ -341,7 +346,6 @@ files:
|
|
341
346
|
- bin/grntest-log-analyze
|
342
347
|
- bin/groonga-index-dump
|
343
348
|
- bin/grndump
|
344
|
-
- README.textile
|
345
349
|
- lib/1.9/groonga.so
|
346
350
|
- lib/2.0/groonga.so
|
347
351
|
- vendor/local/bin/groonga-benchmark.exe
|
@@ -1217,6 +1221,7 @@ test_files:
|
|
1217
1221
|
- test/test-encoding.rb
|
1218
1222
|
- test/test-schema-create-table.rb
|
1219
1223
|
- test/test-type.rb
|
1224
|
+
- test/test-table-key-support.rb
|
1220
1225
|
- test/test-database.rb
|
1221
1226
|
- test/test-variable.rb
|
1222
1227
|
- test/test-table-select.rb
|