rroonga 4.0.8 → 5.0.0
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/doc/text/news.textile +19 -0
- data/ext/groonga/rb-grn-exception.c +35 -1
- data/ext/groonga/rb-grn-normalizer.c +37 -7
- data/ext/groonga/rb-grn-table.c +106 -35
- data/ext/groonga/rb-grn.h +3 -2
- data/lib/groonga/record.rb +45 -1
- data/rroonga-build.rb +6 -5
- data/test/groonga-test-utils.rb +9 -0
- data/test/test-array.rb +11 -0
- data/test/test-exception.rb +3 -1
- data/test/test-normalizer.rb +28 -0
- data/test/test-record.rb +34 -0
- data/test/test-table-group.rb +366 -0
- data/test/test-table.rb +0 -182
- metadata +45 -43
data/test/test-table.rb
CHANGED
|
@@ -630,188 +630,6 @@ class TableTest < Test::Unit::TestCase
|
|
|
630
630
|
assert_not_predicate(bookmarks, :builtin?)
|
|
631
631
|
end
|
|
632
632
|
|
|
633
|
-
class GroupTest < self
|
|
634
|
-
class MaxNSubRecordsTest < self
|
|
635
|
-
setup
|
|
636
|
-
def setup_schema
|
|
637
|
-
Groonga::Schema.define do |schema|
|
|
638
|
-
schema.create_table("Bookmarks", :type => :hash) do |table|
|
|
639
|
-
table.text("title")
|
|
640
|
-
end
|
|
641
|
-
|
|
642
|
-
schema.create_table("Comments", :type => :array) do |table|
|
|
643
|
-
table.reference("bookmark")
|
|
644
|
-
table.text("content")
|
|
645
|
-
table.int32("rank")
|
|
646
|
-
end
|
|
647
|
-
end
|
|
648
|
-
end
|
|
649
|
-
|
|
650
|
-
setup
|
|
651
|
-
def setup_data
|
|
652
|
-
setup_bookmarks
|
|
653
|
-
setup_comments
|
|
654
|
-
end
|
|
655
|
-
|
|
656
|
-
def setup_bookmarks
|
|
657
|
-
@bookmarks = Groonga["Bookmarks"]
|
|
658
|
-
@groonga = @bookmarks.add("http://groonga.org/", :title => "groonga")
|
|
659
|
-
@ruby = @bookmarks.add("http://ruby-lang.org/", :title => "Ruby")
|
|
660
|
-
end
|
|
661
|
-
|
|
662
|
-
def setup_comments
|
|
663
|
-
@comments = Groonga["Comments"]
|
|
664
|
-
@comments.add(:bookmark => @groonga,
|
|
665
|
-
:content => "garbage comment1",
|
|
666
|
-
:rank => 0)
|
|
667
|
-
@comments.add(:bookmark => @groonga,
|
|
668
|
-
:content => "garbage comment2",
|
|
669
|
-
:rank => 0)
|
|
670
|
-
@comments.add(:bookmark => @groonga,
|
|
671
|
-
:content => "full-text search",
|
|
672
|
-
:rank => 1)
|
|
673
|
-
@comments.add(:bookmark => @groonga,
|
|
674
|
-
:content => "column store",
|
|
675
|
-
:rank => 5)
|
|
676
|
-
@comments.add(:bookmark => @ruby,
|
|
677
|
-
:content => "object oriented script language",
|
|
678
|
-
:rank => 100)
|
|
679
|
-
@comments.add(:bookmark => @ruby,
|
|
680
|
-
:content => "multi paradigm programming language",
|
|
681
|
-
:rank => 80)
|
|
682
|
-
end
|
|
683
|
-
|
|
684
|
-
setup
|
|
685
|
-
def setup_searched
|
|
686
|
-
@records = @comments.select do |record|
|
|
687
|
-
record.rank > 0
|
|
688
|
-
end
|
|
689
|
-
end
|
|
690
|
-
|
|
691
|
-
def test_upper_limit
|
|
692
|
-
grouped_records = @records.group("bookmark", :max_n_sub_records => 2)
|
|
693
|
-
groups = grouped_records.collect do |record|
|
|
694
|
-
sub_record_contents = record.sub_records.collect do |sub_record|
|
|
695
|
-
sub_record.content
|
|
696
|
-
end
|
|
697
|
-
[record.title, sub_record_contents]
|
|
698
|
-
end
|
|
699
|
-
assert_equal([
|
|
700
|
-
[
|
|
701
|
-
"groonga",
|
|
702
|
-
[
|
|
703
|
-
"full-text search",
|
|
704
|
-
"column store",
|
|
705
|
-
],
|
|
706
|
-
],
|
|
707
|
-
[
|
|
708
|
-
"Ruby",
|
|
709
|
-
[
|
|
710
|
-
"object oriented script language",
|
|
711
|
-
"multi paradigm programming language",
|
|
712
|
-
],
|
|
713
|
-
],
|
|
714
|
-
],
|
|
715
|
-
groups)
|
|
716
|
-
end
|
|
717
|
-
|
|
718
|
-
def test_less_than_limit
|
|
719
|
-
sorted = @records.sort([{:key => "rank", :order => :descending}],
|
|
720
|
-
:limit => 3, :offset => 0)
|
|
721
|
-
grouped_records = sorted.group("bookmark", :max_n_sub_records => 2)
|
|
722
|
-
groups = grouped_records.collect do |record|
|
|
723
|
-
sub_record_ranks = record.sub_records.collect do |sub_record|
|
|
724
|
-
sub_record.rank
|
|
725
|
-
end
|
|
726
|
-
[record.title, sub_record_ranks]
|
|
727
|
-
end
|
|
728
|
-
assert_equal([
|
|
729
|
-
["Ruby", [100, 80]],
|
|
730
|
-
["groonga", [5]]
|
|
731
|
-
],
|
|
732
|
-
groups)
|
|
733
|
-
end
|
|
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
|
|
813
|
-
end
|
|
814
|
-
|
|
815
633
|
class OtherProcessTest < self
|
|
816
634
|
def test_create
|
|
817
635
|
by_other_process do
|
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
|
+
version: 5.0.0
|
|
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: 2015-
|
|
15
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: pkg-config
|
|
@@ -195,8 +195,8 @@ email:
|
|
|
195
195
|
- dara@shidara.net
|
|
196
196
|
executables:
|
|
197
197
|
- groonga-index-dump
|
|
198
|
-
- grndump
|
|
199
198
|
- groonga-database-inspect
|
|
199
|
+
- grndump
|
|
200
200
|
- grntest-log-analyze
|
|
201
201
|
extensions:
|
|
202
202
|
- ext/groonga/extconf.rb
|
|
@@ -335,6 +335,7 @@ files:
|
|
|
335
335
|
- test/test-statistic-measurer.rb
|
|
336
336
|
- test/test-sub-records.rb
|
|
337
337
|
- test/test-table-dumper.rb
|
|
338
|
+
- test/test-table-group.rb
|
|
338
339
|
- test/test-table-key-support.rb
|
|
339
340
|
- test/test-table-offset-and-limit.rb
|
|
340
341
|
- test/test-table-select-mecab.rb
|
|
@@ -375,57 +376,58 @@ specification_version: 4
|
|
|
375
376
|
summary: Ruby bindings for Groonga that provide full text search and column store
|
|
376
377
|
features.
|
|
377
378
|
test_files:
|
|
378
|
-
- test/test-schema.rb
|
|
379
|
-
- test/test-snippet.rb
|
|
380
|
-
- test/test-variable.rb
|
|
381
|
-
- test/test-geo-point.rb
|
|
382
379
|
- test/test-plugin.rb
|
|
383
|
-
- test/test-accessor.rb
|
|
384
|
-
- test/test-double-array-trie.rb
|
|
385
|
-
- test/test-pagination.rb
|
|
386
|
-
- test/test-memory-pool.rb
|
|
387
|
-
- test/test-column.rb
|
|
388
|
-
- test/test-table-traverse.rb
|
|
389
|
-
- test/test-expression.rb
|
|
390
380
|
- test/test-table-select.rb
|
|
391
|
-
- test/test-encoding.rb
|
|
392
|
-
- test/test-logger.rb
|
|
393
|
-
- test/test-schema-create-table.rb
|
|
394
|
-
- test/test-hash.rb
|
|
395
|
-
- test/test-type.rb
|
|
396
381
|
- test/test-table-offset-and-limit.rb
|
|
382
|
+
- test/test-sub-records.rb
|
|
383
|
+
- test/test-index-cursor.rb
|
|
384
|
+
- test/test-convert.rb
|
|
397
385
|
- test/test-version.rb
|
|
386
|
+
- test/test-table.rb
|
|
398
387
|
- test/test-lock-timeout.rb
|
|
388
|
+
- test/test-schema-create-table.rb
|
|
399
389
|
- test/test-index-column.rb
|
|
400
|
-
- test/test-table-key-support.rb
|
|
401
|
-
- test/test-vector-column.rb
|
|
402
|
-
- test/test-normalizer.rb
|
|
403
|
-
- test/test-table-select-weight.rb
|
|
404
|
-
- test/test-schema-type.rb
|
|
405
|
-
- test/test-sub-records.rb
|
|
406
|
-
- test/test-procedure.rb
|
|
407
|
-
- test/test-context.rb
|
|
408
|
-
- test/test-gqtp.rb
|
|
409
|
-
- test/test-remote.rb
|
|
410
|
-
- test/test-database-dumper.rb
|
|
411
|
-
- test/test-database-inspector.rb
|
|
412
|
-
- test/test-patricia-trie.rb
|
|
413
|
-
- test/run-test.rb
|
|
414
390
|
- test/test-fix-size-column.rb
|
|
415
|
-
- test/test-
|
|
391
|
+
- test/test-table-dumper.rb
|
|
416
392
|
- test/test-array.rb
|
|
417
|
-
- test/test-table.rb
|
|
418
|
-
- test/groonga-test-utils.rb
|
|
419
393
|
- test/test-record.rb
|
|
420
|
-
- test/test-exception.rb
|
|
421
|
-
- test/test-table-select-normalize.rb
|
|
422
394
|
- test/test-schema-dumper.rb
|
|
423
|
-
- test/test-table-dumper.rb
|
|
424
|
-
- test/test-database.rb
|
|
425
395
|
- test/test-variable-size-column.rb
|
|
426
|
-
- test/test-
|
|
396
|
+
- test/test-type.rb
|
|
397
|
+
- test/test-pagination.rb
|
|
398
|
+
- test/test-database-dumper.rb
|
|
399
|
+
- test/test-table-group.rb
|
|
400
|
+
- test/test-accessor.rb
|
|
401
|
+
- test/test-database.rb
|
|
402
|
+
- test/test-database-inspector.rb
|
|
403
|
+
- test/test-procedure.rb
|
|
427
404
|
- test/test-expression-builder.rb
|
|
428
|
-
- test/test-convert.rb
|
|
429
|
-
- test/test-index-cursor.rb
|
|
430
405
|
- test/test-command-select.rb
|
|
406
|
+
- test/test-double-array-trie.rb
|
|
407
|
+
- test/test-vector-column.rb
|
|
408
|
+
- test/test-encoding.rb
|
|
409
|
+
- test/test-table-key-support.rb
|
|
410
|
+
- test/test-gqtp.rb
|
|
411
|
+
- test/run-test.rb
|
|
412
|
+
- test/test-patricia-trie.rb
|
|
413
|
+
- test/test-remote.rb
|
|
414
|
+
- test/test-table-select-weight.rb
|
|
415
|
+
- test/test-statistic-measurer.rb
|
|
416
|
+
- test/test-logger.rb
|
|
417
|
+
- test/test-hash.rb
|
|
418
|
+
- test/test-schema-type.rb
|
|
419
|
+
- test/test-normalizer.rb
|
|
420
|
+
- test/test-snippet.rb
|
|
421
|
+
- test/test-variable.rb
|
|
422
|
+
- test/test-memory-pool.rb
|
|
423
|
+
- test/test-exception.rb
|
|
424
|
+
- test/test-table-select-mecab.rb
|
|
425
|
+
- test/test-table-select-normalize.rb
|
|
426
|
+
- test/test-schema.rb
|
|
427
|
+
- test/test-geo-point.rb
|
|
428
|
+
- test/test-table-traverse.rb
|
|
429
|
+
- test/groonga-test-utils.rb
|
|
430
|
+
- test/test-column.rb
|
|
431
|
+
- test/test-context.rb
|
|
432
|
+
- test/test-expression.rb
|
|
431
433
|
has_rdoc:
|