groonga 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. metadata +38 -227
  2. data/AUTHORS +0 -5
  3. data/NEWS.ja.rdoc +0 -114
  4. data/NEWS.rdoc +0 -116
  5. data/README.ja.rdoc +0 -63
  6. data/README.rdoc +0 -64
  7. data/Rakefile +0 -216
  8. data/benchmark/common.rb +0 -49
  9. data/benchmark/read-write-many-small-items.rb +0 -144
  10. data/benchmark/write-many-small-items.rb +0 -135
  11. data/example/bookmark.rb +0 -161
  12. data/example/index-html.rb +0 -89
  13. data/example/search/config.ru +0 -211
  14. data/example/search/public/css/groonga.css +0 -122
  15. data/ext/.gitignore +0 -2
  16. data/ext/rb-grn-accessor.c +0 -52
  17. data/ext/rb-grn-array-cursor.c +0 -36
  18. data/ext/rb-grn-array.c +0 -210
  19. data/ext/rb-grn-column.c +0 -570
  20. data/ext/rb-grn-context.c +0 -655
  21. data/ext/rb-grn-database.c +0 -415
  22. data/ext/rb-grn-encoding-support.c +0 -64
  23. data/ext/rb-grn-encoding.c +0 -257
  24. data/ext/rb-grn-exception.c +0 -1110
  25. data/ext/rb-grn-expression-builder.c +0 -75
  26. data/ext/rb-grn-expression.c +0 -732
  27. data/ext/rb-grn-fix-size-column.c +0 -166
  28. data/ext/rb-grn-hash-cursor.c +0 -38
  29. data/ext/rb-grn-hash.c +0 -294
  30. data/ext/rb-grn-index-column.c +0 -488
  31. data/ext/rb-grn-logger.c +0 -325
  32. data/ext/rb-grn-object.c +0 -1335
  33. data/ext/rb-grn-operation.c +0 -198
  34. data/ext/rb-grn-patricia-trie-cursor.c +0 -39
  35. data/ext/rb-grn-patricia-trie.c +0 -488
  36. data/ext/rb-grn-procedure.c +0 -52
  37. data/ext/rb-grn-query.c +0 -260
  38. data/ext/rb-grn-record.c +0 -40
  39. data/ext/rb-grn-snippet.c +0 -328
  40. data/ext/rb-grn-table-cursor-key-support.c +0 -69
  41. data/ext/rb-grn-table-cursor.c +0 -246
  42. data/ext/rb-grn-table-key-support.c +0 -731
  43. data/ext/rb-grn-table.c +0 -2038
  44. data/ext/rb-grn-type.c +0 -181
  45. data/ext/rb-grn-utils.c +0 -769
  46. data/ext/rb-grn-variable-size-column.c +0 -36
  47. data/ext/rb-grn-variable.c +0 -108
  48. data/ext/rb-grn.h +0 -684
  49. data/ext/rb-groonga.c +0 -113
  50. data/extconf.rb +0 -216
  51. data/html/bar.svg +0 -153
  52. data/html/developer.html +0 -121
  53. data/html/developer.svg +0 -469
  54. data/html/download.svg +0 -253
  55. data/html/favicon.ico +0 -0
  56. data/html/favicon.xcf +0 -0
  57. data/html/footer.html.erb +0 -28
  58. data/html/head.html.erb +0 -4
  59. data/html/header.html.erb +0 -17
  60. data/html/index.html +0 -147
  61. data/html/install.svg +0 -636
  62. data/html/logo.xcf +0 -0
  63. data/html/ranguba.css +0 -248
  64. data/html/tutorial.svg +0 -559
  65. data/lib/groonga.rb +0 -83
  66. data/lib/groonga/expression-builder.rb +0 -285
  67. data/lib/groonga/patricia-trie.rb +0 -53
  68. data/lib/groonga/record.rb +0 -276
  69. data/lib/groonga/schema.rb +0 -916
  70. data/license/GPL +0 -340
  71. data/license/LGPL +0 -504
  72. data/license/RUBY +0 -59
  73. data/misc/grnop2ruby.rb +0 -49
  74. data/pkg-config.rb +0 -333
  75. data/src/rb-grn-table-cursor.c +0 -296
  76. data/test-unit/Rakefile +0 -40
  77. data/test-unit/TODO +0 -5
  78. data/test-unit/bin/testrb +0 -5
  79. data/test-unit/html/classic.html +0 -15
  80. data/test-unit/html/index.html +0 -25
  81. data/test-unit/html/index.html.ja +0 -27
  82. data/test-unit/lib/test/unit.rb +0 -323
  83. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  84. data/test-unit/lib/test/unit/assertions.rb +0 -1230
  85. data/test-unit/lib/test/unit/attribute.rb +0 -125
  86. data/test-unit/lib/test/unit/autorunner.rb +0 -353
  87. data/test-unit/lib/test/unit/collector.rb +0 -36
  88. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  89. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  90. data/test-unit/lib/test/unit/collector/load.rb +0 -136
  91. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  92. data/test-unit/lib/test/unit/color-scheme.rb +0 -102
  93. data/test-unit/lib/test/unit/color.rb +0 -96
  94. data/test-unit/lib/test/unit/diff.rb +0 -724
  95. data/test-unit/lib/test/unit/error.rb +0 -130
  96. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  97. data/test-unit/lib/test/unit/failure.rb +0 -136
  98. data/test-unit/lib/test/unit/fixture.rb +0 -176
  99. data/test-unit/lib/test/unit/notification.rb +0 -129
  100. data/test-unit/lib/test/unit/omission.rb +0 -191
  101. data/test-unit/lib/test/unit/pending.rb +0 -150
  102. data/test-unit/lib/test/unit/priority.rb +0 -181
  103. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  104. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  105. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  106. data/test-unit/lib/test/unit/testcase.rb +0 -476
  107. data/test-unit/lib/test/unit/testresult.rb +0 -89
  108. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  109. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  110. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -464
  111. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  112. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  113. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
  114. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  115. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  116. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  117. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  118. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  119. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  120. data/test-unit/lib/test/unit/version.rb +0 -7
  121. data/test-unit/sample/adder.rb +0 -13
  122. data/test-unit/sample/subtracter.rb +0 -12
  123. data/test-unit/sample/test_adder.rb +0 -20
  124. data/test-unit/sample/test_subtracter.rb +0 -20
  125. data/test-unit/sample/test_user.rb +0 -23
  126. data/test-unit/test/collector/test-descendant.rb +0 -133
  127. data/test-unit/test/collector/test-load.rb +0 -329
  128. data/test-unit/test/collector/test_dir.rb +0 -406
  129. data/test-unit/test/collector/test_objectspace.rb +0 -100
  130. data/test-unit/test/run-test.rb +0 -15
  131. data/test-unit/test/test-attribute.rb +0 -86
  132. data/test-unit/test/test-color-scheme.rb +0 -67
  133. data/test-unit/test/test-color.rb +0 -47
  134. data/test-unit/test/test-diff.rb +0 -518
  135. data/test-unit/test/test-emacs-runner.rb +0 -60
  136. data/test-unit/test/test-fixture.rb +0 -287
  137. data/test-unit/test/test-notification.rb +0 -33
  138. data/test-unit/test/test-omission.rb +0 -81
  139. data/test-unit/test/test-pending.rb +0 -70
  140. data/test-unit/test/test-priority.rb +0 -119
  141. data/test-unit/test/test-testcase.rb +0 -554
  142. data/test-unit/test/test_assertions.rb +0 -1151
  143. data/test-unit/test/test_error.rb +0 -26
  144. data/test-unit/test/test_failure.rb +0 -33
  145. data/test-unit/test/test_testresult.rb +0 -113
  146. data/test-unit/test/test_testsuite.rb +0 -129
  147. data/test-unit/test/testunit-test-util.rb +0 -14
  148. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  149. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  150. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  151. data/test-unit/test/util/test_observable.rb +0 -102
  152. data/test-unit/test/util/test_procwrapper.rb +0 -36
  153. data/test/.gitignore +0 -1
  154. data/test/groonga-test-utils.rb +0 -106
  155. data/test/run-test.rb +0 -58
  156. data/test/test-array.rb +0 -97
  157. data/test/test-column.rb +0 -298
  158. data/test/test-context.rb +0 -73
  159. data/test/test-database.rb +0 -113
  160. data/test/test-encoding.rb +0 -33
  161. data/test/test-exception.rb +0 -93
  162. data/test/test-expression-builder.rb +0 -156
  163. data/test/test-expression.rb +0 -133
  164. data/test/test-fix-size-column.rb +0 -65
  165. data/test/test-gqtp.rb +0 -70
  166. data/test/test-hash.rb +0 -312
  167. data/test/test-index-column.rb +0 -81
  168. data/test/test-patricia-trie.rb +0 -189
  169. data/test/test-procedure.rb +0 -37
  170. data/test/test-query.rb +0 -22
  171. data/test/test-record.rb +0 -268
  172. data/test/test-remote.rb +0 -53
  173. data/test/test-schema.rb +0 -416
  174. data/test/test-snippet.rb +0 -121
  175. data/test/test-table-cursor.rb +0 -153
  176. data/test/test-table-offset-and-limit.rb +0 -102
  177. data/test/test-table-select-normalize.rb +0 -48
  178. data/test/test-table-select.rb +0 -145
  179. data/test/test-table.rb +0 -642
  180. data/test/test-type.rb +0 -61
  181. data/test/test-variable-size-column.rb +0 -98
  182. data/test/test-variable.rb +0 -28
  183. data/test/test-vector-column.rb +0 -76
  184. data/test/test-version.rb +0 -31
  185. data/text/TUTORIAL.ja.rdoc +0 -392
  186. data/text/expression.rdoc +0 -284
data/test/test-remote.rb DELETED
@@ -1,53 +0,0 @@
1
- # Copyright (C) 2009 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 RemoteTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- setup :before => :append
20
- def setup_remote_connection
21
- @process_id = nil
22
-
23
- package_config = PKGConfig.package_config("groonga")
24
- groonga = package_config.variable("groonga")
25
-
26
- @host = "127.0.0.1"
27
- @port = 12345
28
- @remote_database_path = @tmp_dir + "remote-database"
29
- @process_id = Process.fork do
30
- exec(groonga,
31
- "-i", @host,
32
- "-p", @port.to_s,
33
- "-s", "-n", @remote_database_path.to_s)
34
- end
35
- sleep(1)
36
- end
37
-
38
- teardown
39
- def teardown_remote_connection
40
- Process.kill(:TERM, @process_id) if @process_id
41
- end
42
-
43
- def test_send
44
- _context = Groonga::Context.new
45
- _context.connect(:host => @host, :port => @port)
46
- assert_equal(0, _context.send("status"))
47
- id, result = _context.receive
48
- assert_equal(0, id)
49
- return_code, values = JSON.load(result)
50
- assert_equal([[0], ["alloc_count", "starttime", "uptime"]],
51
- [return_code, values.keys.sort])
52
- end
53
- end
data/test/test-schema.rb DELETED
@@ -1,416 +0,0 @@
1
- # Copyright (C) 2009 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 SchemaTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- setup :setup_database
20
-
21
- def test_create_table
22
- assert_nil(context["Posts"])
23
- Groonga::Schema.create_table("Posts") do |table|
24
- end
25
- assert_not_nil(context["Posts"])
26
- end
27
-
28
- def test_create_table_force
29
- Groonga::Schema.create_table("Posts") do |table|
30
- table.string("name")
31
- end
32
- assert_not_nil(context["Posts.name"])
33
-
34
- Groonga::Schema.create_table("Posts") do |table|
35
- end
36
- assert_not_nil(context["Posts.name"])
37
-
38
- Groonga::Schema.create_table("Posts", :force => true) do |table|
39
- end
40
- assert_nil(context["Posts.name"])
41
- end
42
-
43
- def test_remove_table
44
- Groonga::Array.create(:name => "Posts")
45
- assert_not_nil(context["Posts"])
46
- Groonga::Schema.remove_table("Posts")
47
- assert_nil(context["Posts"])
48
- end
49
-
50
- def test_define_hash
51
- Groonga::Schema.create_table("Posts", :type => :hash) do |table|
52
- end
53
- assert_kind_of(Groonga::Hash, context["Posts"])
54
- end
55
-
56
- def test_define_hash_with_full_option
57
- path = @tmp_dir + "hash.groonga"
58
- tokenizer = context["TokenTrigram"]
59
- Groonga::Schema.create_table("Posts",
60
- :type => :hash,
61
- :key_type => "integer",
62
- :path => path.to_s,
63
- :value_type => "UInt32",
64
- :default_tokenizer => tokenizer) do |table|
65
- end
66
- table = context["Posts"]
67
- assert_equal("#<Groonga::Hash " +
68
- "id: <#{table.id}>, " +
69
- "name: <Posts>, " +
70
- "path: <#{path}>, " +
71
- "domain: <Int32>, " +
72
- "range: <UInt32>, " +
73
- "flags: <>, " +
74
- "encoding: <#{Groonga::Encoding.default.inspect}>, " +
75
- "size: <0>>",
76
- table.inspect)
77
- assert_equal(tokenizer, table.default_tokenizer)
78
- end
79
-
80
- def test_define_patricia_trie
81
- Groonga::Schema.create_table("Posts", :type => :patricia_trie) do |table|
82
- end
83
- assert_kind_of(Groonga::PatriciaTrie, context["Posts"])
84
- end
85
-
86
- def test_define_patricia_trie_with_full_option
87
- path = @tmp_dir + "patricia-trie.groonga"
88
- Groonga::Schema.create_table("Posts",
89
- :type => :patricia_trie,
90
- :key_type => "integer",
91
- :path => path.to_s,
92
- :value_type => "Float",
93
- :default_tokenizer => "TokenBigram",
94
- :key_normalize => true,
95
- :key_with_sis => true) do |table|
96
- end
97
- table = context["Posts"]
98
- assert_equal("#<Groonga::PatriciaTrie " +
99
- "id: <#{table.id}>, " +
100
- "name: <Posts>, " +
101
- "path: <#{path}>, " +
102
- "domain: <Int32>, " +
103
- "range: <Float>, " +
104
- "flags: <KEY_WITH_SIS|KEY_NORMALIZE|WITH_SECTION>, " +
105
- "encoding: <#{Groonga::Encoding.default.inspect}>, " +
106
- "size: <0>>",
107
- table.inspect)
108
- assert_equal(context["TokenBigram"], table.default_tokenizer)
109
- end
110
-
111
- def test_define_array
112
- Groonga::Schema.create_table("Posts", :type => :array) do |table|
113
- end
114
- assert_kind_of(Groonga::Array, context["Posts"])
115
- end
116
-
117
- def test_define_array_with_full_option
118
- path = @tmp_dir + "array.groonga"
119
- Groonga::Schema.create_table("Posts",
120
- :type => :array,
121
- :path => path.to_s,
122
- :value_type => "Int32") do |table|
123
- end
124
- table = context["Posts"]
125
- assert_equal("#<Groonga::Array " +
126
- "id: <#{table.id}>, " +
127
- "name: <Posts>, " +
128
- "path: <#{path}>, " +
129
- "domain: <Int32>, " +
130
- "range: <Int32>, " +
131
- "flags: <>, " +
132
- "size: <0>>",
133
- table.inspect)
134
- end
135
-
136
- def test_column_with_full_option
137
- path = @tmp_dir + "column.groonga"
138
- type = Groonga::Type.new("Niku", :size => 29)
139
- Groonga::Schema.create_table("Posts") do |table|
140
- table.column("rate",
141
- type,
142
- :path => path.to_s,
143
- :persistent => true,
144
- :type => :vector,
145
- :compress => :lzo)
146
- end
147
-
148
- column_name = "Posts.rate"
149
- column = context[column_name]
150
- assert_equal("#<Groonga::VariableSizeColumn " +
151
- "id: <#{column.id}>, " +
152
- "name: <#{column_name}>, " +
153
- "path: <#{path}>, " +
154
- "domain: <Posts>, " +
155
- "range: <Niku>, " +
156
- "flags: <COMPRESS_LZO>>",
157
- column.inspect)
158
- end
159
-
160
- def test_integer32_column
161
- assert_nil(context["Posts.rate"])
162
- Groonga::Schema.create_table("Posts") do |table|
163
- table.integer32 :rate
164
- end
165
- assert_equal(context["Int32"], context["Posts.rate"].range)
166
- end
167
-
168
- def test_integer64_column
169
- assert_nil(context["Posts.rate"])
170
- Groonga::Schema.create_table("Posts") do |table|
171
- table.integer64 :rate
172
- end
173
- assert_equal(context["Int64"], context["Posts.rate"].range)
174
- end
175
-
176
- def test_unsigned_integer32_column
177
- assert_nil(context["Posts.n_viewed"])
178
- Groonga::Schema.create_table("Posts") do |table|
179
- table.unsigned_integer32 :n_viewed
180
- end
181
- assert_equal(context["UInt32"], context["Posts.n_viewed"].range)
182
- end
183
-
184
- def test_unsigned_integer64_column
185
- assert_nil(context["Posts.n_viewed"])
186
- Groonga::Schema.create_table("Posts") do |table|
187
- table.unsigned_integer64 :n_viewed
188
- end
189
- assert_equal(context["UInt64"], context["Posts.n_viewed"].range)
190
- end
191
-
192
- def test_float_column
193
- assert_nil(context["Posts.rate"])
194
- Groonga::Schema.create_table("Posts") do |table|
195
- table.float :rate
196
- end
197
- assert_equal(context["Float"], context["Posts.rate"].range)
198
- end
199
-
200
- def test_time_column
201
- assert_nil(context["Posts.last_modified"])
202
- Groonga::Schema.create_table("Posts") do |table|
203
- table.time :last_modified
204
- end
205
- assert_equal(context["Time"], context["Posts.last_modified"].range)
206
- end
207
-
208
- def test_short_text_column
209
- assert_nil(context["Posts.title"])
210
- Groonga::Schema.create_table("Posts") do |table|
211
- table.short_text :title
212
- end
213
- assert_equal(context["ShortText"], context["Posts.title"].range)
214
- end
215
-
216
- def test_text_column
217
- assert_nil(context["Posts.comment"])
218
- Groonga::Schema.create_table("Posts") do |table|
219
- table.text :comment
220
- end
221
- assert_equal(context["Text"], context["Posts.comment"].range)
222
- end
223
-
224
- def test_long_text_column
225
- assert_nil(context["Posts.content"])
226
- Groonga::Schema.create_table("Posts") do |table|
227
- table.long_text :content
228
- end
229
- assert_equal(context["LongText"], context["Posts.content"].range)
230
- end
231
-
232
- def test_remove_column
233
- Groonga::Schema.create_table("Posts") do |table|
234
- table.long_text :content
235
- end
236
- assert_not_nil(context["Posts.content"])
237
-
238
- Groonga::Schema.change_table("Posts") do |table|
239
- table.remove_column("content")
240
- end
241
- assert_nil(context["Posts.content"])
242
- end
243
-
244
- def test_column_again
245
- Groonga::Schema.create_table("Posts") do |table|
246
- table.text :content
247
- end
248
-
249
- assert_nothing_raised do
250
- Groonga::Schema.create_table("Posts") do |table|
251
- table.text :content
252
- end
253
- end
254
- end
255
-
256
- def test_column_again_with_difference_type
257
- Groonga::Schema.create_table("Posts") do |table|
258
- table.text :content
259
- end
260
-
261
- assert_raise(ArgumentError) do
262
- Groonga::Schema.create_table("Posts") do |table|
263
- table.integer :content
264
- end
265
- end
266
- end
267
-
268
- def test_index
269
- assert_nil(context["Terms.content"])
270
- Groonga::Schema.create_table("Posts") do |table|
271
- table.long_text :content
272
- end
273
- Groonga::Schema.create_table("Terms") do |table|
274
- table.index "Posts.content"
275
- end
276
- assert_equal([context["Posts.content"]],
277
- context["Terms.Posts_content"].sources)
278
- end
279
-
280
- def test_index_with_full_option
281
- path = @tmp_dir + "index-column.groonga"
282
- assert_nil(context["Terms.content"])
283
- index_column_name = "Posts-index"
284
-
285
- Groonga::Schema.create_table("Posts") do |table|
286
- table.long_text :content
287
- end
288
- Groonga::Schema.create_table("Terms") do |table|
289
- table.index("Posts.content",
290
- :name => index_column_name,
291
- :path => path.to_s,
292
- :persistent => true,
293
- :with_section => true,
294
- :with_weight => true,
295
- :with_position => true)
296
- end
297
-
298
- posts = context["Posts"]
299
- terms = context["Terms"]
300
- full_index_column_name = "Terms.#{index_column_name}"
301
- index_column = context[full_index_column_name]
302
- assert_equal("#<Groonga::IndexColumn " +
303
- "id: <#{index_column.id}>, " +
304
- "name: <#{full_index_column_name}>, " +
305
- "path: <#{path}>, " +
306
- "domain: <Terms>, " +
307
- "range: <Posts>, " +
308
- "flags: <WITH_SECTION|WITH_WEIGHT|WITH_POSITION|" +
309
- "UNIT_DOCUMENT_SECTION|UNIT_DOCUMENT_POSITION|" +
310
- "UNIT_USERDEF_DOCUMENT|UNIT_USERDEF_SECTION>>",
311
- index_column.inspect)
312
- end
313
-
314
- def test_index_again
315
- Groonga::Schema.create_table("Posts") do |table|
316
- table.long_text :content
317
- end
318
- Groonga::Schema.create_table("Terms") do |table|
319
- table.index "Posts.content"
320
- end
321
-
322
- assert_nothing_raised do
323
- Groonga::Schema.create_table("Terms") do |table|
324
- table.index "Posts.content"
325
- end
326
- end
327
- end
328
-
329
- def test_index_again_with_difference_source
330
- Groonga::Schema.create_table("Posts") do |table|
331
- table.long_text :content
332
- table.short_text :name
333
- end
334
- Groonga::Schema.create_table("Terms") do |table|
335
- table.index "Posts.content"
336
- end
337
-
338
- assert_raise(ArgumentError) do
339
- Groonga::Schema.create_table("Terms") do |table|
340
- table.index "Posts.name", :name => "Posts_content"
341
- end
342
- end
343
- end
344
-
345
- def test_dump
346
- Groonga::Schema.define do |schema|
347
- schema.create_table("Posts") do |table|
348
- table.short_text :title
349
- end
350
- end
351
- assert_equal(<<-EOS, Groonga::Schema.dump)
352
- create_table("Posts") do |table|
353
- table.short_text("title")
354
- end
355
- EOS
356
- end
357
-
358
- def test_reference_dump
359
- Groonga::Schema.define do |schema|
360
- schema.create_table("Items") do |table|
361
- table.short_text("title")
362
- end
363
-
364
- schema.create_table("Users") do |table|
365
- table.short_text("name")
366
- end
367
-
368
- schema.create_table("Comments") do |table|
369
- table.reference("item", "Items")
370
- table.reference("author", "Users")
371
- table.text("content")
372
- table.time("issued")
373
- end
374
- end
375
-
376
- assert_equal(<<-EOS, Groonga::Schema.dump)
377
- create_table("Comments") do |table|
378
- table.text("content")
379
- table.time("issued")
380
- end
381
-
382
- create_table("Items") do |table|
383
- table.short_text("title")
384
- end
385
-
386
- create_table("Users") do |table|
387
- table.short_text("name")
388
- end
389
-
390
- change_table("Comments") do |table|
391
- table.reference("author", "Users")
392
- table.reference("item", "Items")
393
- end
394
- EOS
395
- end
396
-
397
- def test_explicit_context_create_table
398
- context = Groonga::Context.default
399
- Groonga::Context.default = nil
400
-
401
- Groonga::Schema.define(:context => context) do |schema|
402
- schema.create_table('Items', :type => :hash) do |table|
403
- table.text("text")
404
- end
405
- schema.create_table("TermsText",
406
- :type => :patricia_trie,
407
- :key_normalize => true,
408
- :default_tokenizer => "TokenBigram") do |table|
409
- table.index('Items.text')
410
- end
411
- end
412
-
413
- assert_not_nil(context["Items.text"])
414
- assert_not_nil(context["TermsText.Items_text"])
415
- end
416
- end