rroonga 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2011-2014 Kouhei Sutou <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
@@ -350,4 +350,49 @@ load --table Users
350
350
  EOS
351
351
  end
352
352
  end
353
+
354
+ class WeightVectorIndexTest < self
355
+ def setup
356
+ Groonga::Schema.define do |schema|
357
+ schema.create_table("Products",
358
+ :type => :patricia_trie,
359
+ :key_type => "ShortText") do |table|
360
+ table.short_text("tags",
361
+ :type => :vector,
362
+ :with_weight => true)
363
+ end
364
+ end
365
+ end
366
+
367
+ def products
368
+ Groonga["Products"]
369
+ end
370
+
371
+ def test_weight
372
+ products.add("Groonga", :tags => [
373
+ {
374
+ :value => "groonga",
375
+ :weight => 100,
376
+ },
377
+ ])
378
+ products.add("Mroonga", :tags => [
379
+ {
380
+ :value => "mroonga",
381
+ :weight => 100,
382
+ },
383
+ {
384
+ :value => "groonga",
385
+ :weight => 10,
386
+ },
387
+ ])
388
+ assert_equal(<<-COMMAND, dump("Products"))
389
+ load --table Products
390
+ [
391
+ [\"_key\",\"tags\"],
392
+ [\"Groonga\",{\"groonga\":100}],
393
+ [\"Mroonga\",{\"groonga\":10,\"mroonga\":100}]
394
+ ]
395
+ COMMAND
396
+ end
397
+ end
353
398
  end
@@ -120,4 +120,16 @@ class TableSelectWeightTest < Test::Unit::TestCase
120
120
  [record.title, record.score]
121
121
  end
122
122
  end
123
+
124
+ def test_one_column_only
125
+ result = @comments.select do |record|
126
+ record.match("Hello") do |match_record|
127
+ match_record.title
128
+ end
129
+ end
130
+ assert_equal_select_result([["Hello", 1]],
131
+ result) do |record|
132
+ [record.title, record.score]
133
+ end
134
+ end
123
135
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,10 @@ class VariableSizeColumnTest < Test::Unit::TestCase
18
18
 
19
19
  def setup
20
20
  setup_database
21
+ setup_schema
22
+ end
21
23
 
24
+ def setup_schema
22
25
  setup_users_table
23
26
  setup_users
24
27
  end
@@ -113,8 +116,9 @@ class VariableSizeColumnTest < Test::Unit::TestCase
113
116
  end
114
117
 
115
118
  def test_defrag
116
- 1000.times do |i|
117
- @users.add(:name => "user #{i}" * 1000)
119
+ large_data = "x" * (2 ** 16)
120
+ 100.times do |i|
121
+ @users.add(:name => "user #{i}" + large_data)
118
122
  end
119
123
  assert_equal(1, @name.defrag)
120
124
  end
@@ -232,5 +236,85 @@ class VariableSizeColumnTest < Test::Unit::TestCase
232
236
  groonga_org.modified_times.collect(&:key))
233
237
  end
234
238
  end
239
+
240
+ class WeightTest < self
241
+ def setup_schema
242
+ Groonga::Schema.define do |schema|
243
+ schema.create_table("Products",
244
+ :type => :patricia_trie,
245
+ :key_type => :short_text) do |table|
246
+ table.short_text("tags",
247
+ :type => :vector,
248
+ :with_weight => true)
249
+ end
250
+ end
251
+
252
+ @products = Groonga["Products"]
253
+ end
254
+
255
+ def test_string_key
256
+ groonga = @products.add("Groonga")
257
+ groonga.tags = [
258
+ {
259
+ "value" => "groonga",
260
+ "weight" => 100,
261
+ },
262
+ ]
263
+
264
+ assert_equal([
265
+ {
266
+ :value => "groonga",
267
+ :weight => 100,
268
+ },
269
+ ],
270
+ groonga.tags)
271
+ end
272
+
273
+ def test_array
274
+ groonga = @products.add("Groonga")
275
+ groonga.tags = [
276
+ {
277
+ :value => "groonga",
278
+ :weight => 100,
279
+ },
280
+ {
281
+ :value => "full text search",
282
+ :weight => 1000,
283
+ },
284
+ ]
285
+
286
+ assert_equal([
287
+ {
288
+ :value => "groonga",
289
+ :weight => 100,
290
+ },
291
+ {
292
+ :value => "full text search",
293
+ :weight => 1000,
294
+ },
295
+ ],
296
+ groonga.tags)
297
+ end
298
+
299
+ def test_hash
300
+ groonga = @products.add("Groonga")
301
+ groonga.tags = {
302
+ "groonga" => 100,
303
+ "full text search" => 1000,
304
+ }
305
+
306
+ assert_equal([
307
+ {
308
+ :value => "groonga",
309
+ :weight => 100,
310
+ },
311
+ {
312
+ :value => "full text search",
313
+ :weight => 1000,
314
+ },
315
+ ],
316
+ groonga.tags)
317
+ end
318
+ end
235
319
  end
236
320
  end
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: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-02-08 00:00:00.000000000 Z
15
+ date: 2014-04-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config
@@ -194,9 +194,9 @@ email:
194
194
  - y.hayamizu@gmail.com
195
195
  - dara@shidara.net
196
196
  executables:
197
- - grntest-log-analyze
198
197
  - groonga-database-inspect
199
198
  - groonga-index-dump
199
+ - grntest-log-analyze
200
200
  - grndump
201
201
  extensions:
202
202
  - ext/groonga/extconf.rb
@@ -207,143 +207,144 @@ files:
207
207
  - AUTHORS
208
208
  - Rakefile
209
209
  - Gemfile
210
+ - .yardopts
210
211
  - doc/text/install.textile
211
- - doc/text/tutorial.textile
212
212
  - doc/text/news.textile
213
+ - doc/text/tutorial.textile
213
214
  - rroonga.gemspec
214
215
  - rroonga-build.rb
215
216
  - extconf.rb
216
- - lib/groonga.rb
217
+ - lib/groonga/schema.rb
218
+ - lib/groonga/database.rb
217
219
  - lib/groonga/geo-point.rb
218
- - lib/groonga/table.rb
219
- - lib/groonga/logger.rb
220
- - lib/groonga/record.rb
221
- - lib/groonga/index-column.rb
222
- - lib/groonga/database-inspector.rb
220
+ - lib/groonga/expression-builder-19.rb
223
221
  - lib/groonga/sub-records.rb
224
- - lib/groonga/memory-pool.rb
225
- - lib/groonga/context.rb
226
- - lib/groonga/grntest-log.rb
227
222
  - lib/groonga/pagination.rb
228
- - lib/groonga/database.rb
229
- - lib/groonga/column.rb
230
- - lib/groonga/schema.rb
231
- - lib/groonga/statistic-measurer.rb
232
- - lib/groonga/posting.rb
223
+ - lib/groonga/index-column.rb
233
224
  - lib/groonga/patricia-trie.rb
234
- - lib/groonga/expression-builder.rb
225
+ - lib/groonga/database-inspector.rb
235
226
  - lib/groonga/context/command-executor.rb
227
+ - lib/groonga/statistic-measurer.rb
228
+ - lib/groonga/grntest-log.rb
236
229
  - lib/groonga/dumper.rb
230
+ - lib/groonga/posting.rb
231
+ - lib/groonga/memory-pool.rb
232
+ - lib/groonga/table.rb
237
233
  - lib/groonga/query-logger.rb
238
- - lib/groonga/expression-builder-19.rb
239
- - benchmark/create-wikipedia-database.rb
234
+ - lib/groonga/context.rb
235
+ - lib/groonga/column.rb
236
+ - lib/groonga/record.rb
237
+ - lib/groonga/expression-builder.rb
238
+ - lib/groonga/logger.rb
239
+ - lib/groonga.rb
240
240
  - benchmark/common.rb
241
- - benchmark/write-many-small-items.rb
241
+ - benchmark/repeat-load.rb
242
242
  - benchmark/read-write-many-small-items.rb
243
+ - benchmark/create-wikipedia-database.rb
244
+ - benchmark/write-many-small-items.rb
243
245
  - benchmark/select.rb
244
- - benchmark/repeat-load.rb
245
246
  - misc/grnop2ruby.rb
246
247
  - example/index-html.rb
247
248
  - example/bookmark.rb
248
- - ext/groonga/rb-grn-exception.c
249
- - ext/groonga/rb-grn-hash-cursor.c
250
- - ext/groonga/rb-grn-record.c
249
+ - ext/groonga/rb-grn-procedure.c
250
+ - ext/groonga/rb-grn-column.c
251
+ - ext/groonga/rb-grn-index-column.c
252
+ - ext/groonga/rb-grn-encoding-support.c
251
253
  - ext/groonga/rb-grn-variable.c
254
+ - ext/groonga/rb-grn-table.c
255
+ - ext/groonga/rb-grn-hash-cursor.c
252
256
  - ext/groonga/rb-grn-table-cursor-key-support.c
257
+ - ext/groonga/rb-grn-object.c
258
+ - ext/groonga/rb-grn-double-array-trie.c
259
+ - ext/groonga/rb-grn-table-key-support.c
260
+ - ext/groonga/rb-grn-array.c
261
+ - ext/groonga/rb-grn-patricia-trie.c
262
+ - ext/groonga/rb-grn-double-array-trie-cursor.c
263
+ - ext/groonga/rb-grn-utils.c
264
+ - ext/groonga/rb-grn-record.c
253
265
  - ext/groonga/rb-grn-normalizer.c
254
- - ext/groonga/rb-grn-fix-size-column.c
255
- - ext/groonga/rb-grn-context.c
256
- - ext/groonga/rb-grn-plugin.c
257
- - ext/groonga/rb-grn-hash.c
266
+ - ext/groonga/rb-groonga.c
267
+ - ext/groonga/rb-grn-exception.c
258
268
  - ext/groonga/rb-grn-variable-size-column.c
259
- - ext/groonga/rb-grn-index-column.c
269
+ - ext/groonga/rb-grn-encoding.c
270
+ - ext/groonga/rb-grn-geo-point.c
271
+ - ext/groonga/rb-grn-expression-builder.c
260
272
  - ext/groonga/rb-grn-operator.c
261
- - ext/groonga/rb-grn-table-key-support.c
262
- - ext/groonga/rb-grn-patricia-trie.c
263
- - ext/groonga/rb-grn-table-cursor.c
264
- - ext/groonga/rb-grn-object.c
265
- - ext/groonga/rb-grn-table.c
266
- - ext/groonga/rb-grn-procedure.c
267
273
  - ext/groonga/rb-grn-snippet.c
268
- - ext/groonga/rb-grn-encoding-support.c
269
- - ext/groonga/rb-grn-patricia-trie-cursor.c
270
- - ext/groonga/rb-grn-array.c
274
+ - ext/groonga/rb-grn-array-cursor.c
275
+ - ext/groonga/rb-grn-type.c
276
+ - ext/groonga/rb-grn-table-cursor.c
277
+ - ext/groonga/rb-grn-fix-size-column.c
278
+ - ext/groonga/rb-grn-logger.c
279
+ - ext/groonga/rb-grn-plugin.c
271
280
  - ext/groonga/rb-grn-database.c
272
- - ext/groonga/rb-grn-query-logger.c
273
- - ext/groonga/rb-grn-column.c
281
+ - ext/groonga/rb-grn-patricia-trie-cursor.c
274
282
  - ext/groonga/rb-grn-index-cursor.c
275
- - ext/groonga/rb-grn-type.c
276
283
  - ext/groonga/rb-grn-accessor.c
277
- - ext/groonga/rb-grn-double-array-trie-cursor.c
284
+ - ext/groonga/rb-grn-context.c
285
+ - ext/groonga/rb-grn-query-logger.c
278
286
  - ext/groonga/rb-grn-posting.c
279
- - ext/groonga/rb-groonga.c
280
- - ext/groonga/rb-grn-geo-point.c
281
- - ext/groonga/rb-grn-array-cursor.c
282
- - ext/groonga/rb-grn-utils.c
283
- - ext/groonga/rb-grn-logger.c
284
287
  - ext/groonga/rb-grn-expression.c
285
- - ext/groonga/rb-grn-encoding.c
286
- - ext/groonga/rb-grn-expression-builder.c
287
- - ext/groonga/rb-grn-double-array-trie.c
288
+ - ext/groonga/rb-grn-hash.c
288
289
  - ext/groonga/rb-grn.h
289
290
  - ext/groonga/extconf.rb
290
291
  - ext/groonga/groonga.def
291
- - test/test-remote.rb
292
- - test/test-accessor.rb
293
- - test/test-database-dumper.rb
292
+ - test/test-normalizer.rb
293
+ - test/test-schema.rb
294
+ - test/test-vector-column.rb
295
+ - test/test-schema-dumper.rb
296
+ - test/run-test.rb
294
297
  - test/test-database-inspector.rb
295
- - test/test-index-column.rb
296
- - test/groonga-test-utils.rb
297
- - test/test-pagination.rb
298
+ - test/test-procedure.rb
299
+ - test/test-hash.rb
300
+ - test/test-expression.rb
301
+ - test/test-version.rb
302
+ - test/test-remote.rb
303
+ - test/test-table-offset-and-limit.rb
304
+ - test/test-expression-builder.rb
305
+ - test/test-sub-records.rb
306
+ - test/test-encoding.rb
307
+ - test/test-snippet.rb
308
+ - test/test-statistic-measurer.rb
309
+ - test/test-index-cursor.rb
310
+ - test/test-type.rb
311
+ - test/test-table-dumper.rb
312
+ - test/test-table-traverse.rb
313
+ - test/test-convert.rb
298
314
  - test/test-table.rb
315
+ - test/test-pagination.rb
316
+ - test/groonga-test-utils.rb
317
+ - test/test-logger.rb
318
+ - test/test-context.rb
299
319
  - test/test-memory-pool.rb
300
- - test/test-variable-size-column.rb
320
+ - test/test-table-select-weight.rb
321
+ - test/test-exception.rb
322
+ - test/test-table-select-normalize.rb
323
+ - test/test-command-select.rb
324
+ - test/test-gqtp.rb
325
+ - test/test-database-dumper.rb
326
+ - test/test-index-column.rb
327
+ - test/test-geo-point.rb
301
328
  - test/test-plugin.rb
302
- - test/test-hash.rb
303
- - test/test-table-traverse.rb
304
- - test/test-encoding.rb
329
+ - test/test-variable-size-column.rb
305
330
  - test/test-schema-create-table.rb
306
- - test/test-type.rb
331
+ - test/test-array.rb
332
+ - test/test-fix-size-column.rb
307
333
  - test/test-table-key-support.rb
308
- - test/test-database.rb
309
- - test/test-variable.rb
334
+ - test/test-schema-type.rb
310
335
  - test/test-table-select.rb
311
- - test/test-patricia-trie.rb
312
- - test/test-geo-point.rb
313
- - test/test-expression-builder.rb
314
- - test/test-logger.rb
315
- - test/test-array.rb
316
- - test/test-record.rb
317
- - test/test-statistic-measurer.rb
336
+ - test/test-variable.rb
318
337
  - test/test-column.rb
319
- - test/test-fix-size-column.rb
320
- - test/run-test.rb
321
- - test/test-procedure.rb
322
- - test/test-table-dumper.rb
323
- - test/test-schema.rb
338
+ - test/test-patricia-trie.rb
324
339
  - test/test-table-select-mecab.rb
325
- - test/test-command-select.rb
326
- - test/test-table-select-normalize.rb
327
- - test/test-expression.rb
328
- - test/test-normalizer.rb
329
- - test/test-vector-column.rb
330
- - test/test-version.rb
331
- - test/test-index-cursor.rb
332
- - test/test-double-array-trie.rb
340
+ - test/test-accessor.rb
341
+ - test/test-database.rb
333
342
  - test/test-lock-timeout.rb
334
- - test/test-exception.rb
335
- - test/test-schema-dumper.rb
336
- - test/test-schema-type.rb
337
- - test/test-table-select-weight.rb
338
- - test/test-convert.rb
339
- - test/test-gqtp.rb
340
- - test/test-context.rb
341
- - test/test-snippet.rb
342
- - test/test-table-offset-and-limit.rb
343
- - test/test-sub-records.rb
344
- - bin/grntest-log-analyze
343
+ - test/test-double-array-trie.rb
344
+ - test/test-record.rb
345
345
  - bin/groonga-database-inspect
346
346
  - bin/groonga-index-dump
347
+ - bin/grntest-log-analyze
347
348
  - bin/grndump
348
349
  homepage: http://groonga.rubyforge.org/#about-rroonga
349
350
  licenses:
@@ -372,57 +373,57 @@ specification_version: 4
372
373
  summary: Ruby bindings for Groonga that provide full text search and column store
373
374
  features.
374
375
  test_files:
375
- - test/test-remote.rb
376
- - test/test-accessor.rb
377
- - test/test-database-dumper.rb
376
+ - test/test-normalizer.rb
377
+ - test/test-schema.rb
378
+ - test/test-vector-column.rb
379
+ - test/test-schema-dumper.rb
380
+ - test/run-test.rb
378
381
  - test/test-database-inspector.rb
379
- - test/test-index-column.rb
380
- - test/groonga-test-utils.rb
381
- - test/test-pagination.rb
382
+ - test/test-procedure.rb
383
+ - test/test-hash.rb
384
+ - test/test-expression.rb
385
+ - test/test-version.rb
386
+ - test/test-remote.rb
387
+ - test/test-table-offset-and-limit.rb
388
+ - test/test-expression-builder.rb
389
+ - test/test-sub-records.rb
390
+ - test/test-encoding.rb
391
+ - test/test-snippet.rb
392
+ - test/test-statistic-measurer.rb
393
+ - test/test-index-cursor.rb
394
+ - test/test-type.rb
395
+ - test/test-table-dumper.rb
396
+ - test/test-table-traverse.rb
397
+ - test/test-convert.rb
382
398
  - test/test-table.rb
399
+ - test/test-pagination.rb
400
+ - test/groonga-test-utils.rb
401
+ - test/test-logger.rb
402
+ - test/test-context.rb
383
403
  - test/test-memory-pool.rb
384
- - test/test-variable-size-column.rb
404
+ - test/test-table-select-weight.rb
405
+ - test/test-exception.rb
406
+ - test/test-table-select-normalize.rb
407
+ - test/test-command-select.rb
408
+ - test/test-gqtp.rb
409
+ - test/test-database-dumper.rb
410
+ - test/test-index-column.rb
411
+ - test/test-geo-point.rb
385
412
  - test/test-plugin.rb
386
- - test/test-hash.rb
387
- - test/test-table-traverse.rb
388
- - test/test-encoding.rb
413
+ - test/test-variable-size-column.rb
389
414
  - test/test-schema-create-table.rb
390
- - test/test-type.rb
415
+ - test/test-array.rb
416
+ - test/test-fix-size-column.rb
391
417
  - test/test-table-key-support.rb
392
- - test/test-database.rb
393
- - test/test-variable.rb
418
+ - test/test-schema-type.rb
394
419
  - test/test-table-select.rb
395
- - test/test-patricia-trie.rb
396
- - test/test-geo-point.rb
397
- - test/test-expression-builder.rb
398
- - test/test-logger.rb
399
- - test/test-array.rb
400
- - test/test-record.rb
401
- - test/test-statistic-measurer.rb
420
+ - test/test-variable.rb
402
421
  - test/test-column.rb
403
- - test/test-fix-size-column.rb
404
- - test/run-test.rb
405
- - test/test-procedure.rb
406
- - test/test-table-dumper.rb
407
- - test/test-schema.rb
422
+ - test/test-patricia-trie.rb
408
423
  - test/test-table-select-mecab.rb
409
- - test/test-command-select.rb
410
- - test/test-table-select-normalize.rb
411
- - test/test-expression.rb
412
- - test/test-normalizer.rb
413
- - test/test-vector-column.rb
414
- - test/test-version.rb
415
- - test/test-index-cursor.rb
416
- - test/test-double-array-trie.rb
424
+ - test/test-accessor.rb
425
+ - test/test-database.rb
417
426
  - test/test-lock-timeout.rb
418
- - test/test-exception.rb
419
- - test/test-schema-dumper.rb
420
- - test/test-schema-type.rb
421
- - test/test-table-select-weight.rb
422
- - test/test-convert.rb
423
- - test/test-gqtp.rb
424
- - test/test-context.rb
425
- - test/test-snippet.rb
426
- - test/test-table-offset-and-limit.rb
427
- - test/test-sub-records.rb
427
+ - test/test-double-array-trie.rb
428
+ - test/test-record.rb
428
429
  has_rdoc: