rroonga 0.9.4-x86-mingw32 → 0.9.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/NEWS.ja.rdoc +29 -0
  2. data/NEWS.rdoc +29 -0
  3. data/Rakefile +6 -6
  4. data/ext/groonga/rb-grn-array.c +1 -1
  5. data/ext/groonga/rb-grn-context.c +15 -28
  6. data/ext/groonga/rb-grn-exception.c +46 -1
  7. data/ext/groonga/rb-grn-expression.c +22 -13
  8. data/ext/groonga/rb-grn-fix-size-column.c +2 -8
  9. data/ext/groonga/rb-grn-hash.c +8 -1
  10. data/ext/groonga/rb-grn-object.c +1 -1
  11. data/ext/groonga/rb-grn-patricia-trie.c +23 -1
  12. data/ext/groonga/rb-grn-table-key-support.c +22 -0
  13. data/ext/groonga/rb-grn-table.c +37 -5
  14. data/ext/groonga/rb-grn-utils.c +20 -2
  15. data/ext/groonga/rb-grn.h +1 -1
  16. data/ext/groonga/rb-groonga.c +76 -38
  17. data/extconf.rb +17 -1
  18. data/html/developer.html +32 -7
  19. data/html/footer.html.erb +5 -0
  20. data/html/heading-mark.svg +393 -0
  21. data/html/index.html +33 -3
  22. data/lib/1.8/groonga.so +0 -0
  23. data/lib/1.9/groonga.so +0 -0
  24. data/lib/groonga.rb +3 -7
  25. data/lib/groonga/context.rb +2 -13
  26. data/lib/groonga/expression-builder.rb +273 -67
  27. data/lib/groonga/pagination.rb +143 -0
  28. data/lib/groonga/record.rb +2 -0
  29. data/lib/groonga/schema.rb +140 -29
  30. data/pkg/rroonga-0.9.5/NEWS.ja.rdoc +156 -0
  31. data/pkg/rroonga-0.9.5/NEWS.rdoc +158 -0
  32. data/pkg/rroonga-0.9.5/README.ja.rdoc +65 -0
  33. data/pkg/rroonga-0.9.5/README.rdoc +66 -0
  34. data/pkg/rroonga-0.9.5/text/TUTORIAL.ja.rdoc +394 -0
  35. data/pkg/rroonga-0.9.5/text/expression.rdoc +285 -0
  36. data/rroonga-build.rb +2 -2
  37. data/test-unit/Rakefile +40 -0
  38. data/test-unit/TODO +5 -0
  39. data/test-unit/bin/testrb +5 -0
  40. data/test-unit/html/classic.html +15 -0
  41. data/test-unit/html/index.html +25 -0
  42. data/test-unit/html/index.html.ja +27 -0
  43. data/test-unit/lib/test/unit.rb +323 -0
  44. data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
  45. data/test-unit/lib/test/unit/assertions.rb +1230 -0
  46. data/test-unit/lib/test/unit/attribute.rb +125 -0
  47. data/test-unit/lib/test/unit/autorunner.rb +360 -0
  48. data/test-unit/lib/test/unit/collector.rb +36 -0
  49. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  50. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  51. data/test-unit/lib/test/unit/collector/load.rb +144 -0
  52. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  53. data/test-unit/lib/test/unit/color-scheme.rb +102 -0
  54. data/test-unit/lib/test/unit/color.rb +96 -0
  55. data/test-unit/lib/test/unit/diff.rb +724 -0
  56. data/test-unit/lib/test/unit/error.rb +130 -0
  57. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  58. data/test-unit/lib/test/unit/failure.rb +136 -0
  59. data/test-unit/lib/test/unit/fixture.rb +176 -0
  60. data/test-unit/lib/test/unit/notification.rb +129 -0
  61. data/test-unit/lib/test/unit/omission.rb +191 -0
  62. data/test-unit/lib/test/unit/pending.rb +150 -0
  63. data/test-unit/lib/test/unit/priority.rb +180 -0
  64. data/test-unit/lib/test/unit/runner/console.rb +52 -0
  65. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  66. data/test-unit/lib/test/unit/runner/tap.rb +8 -0
  67. data/test-unit/lib/test/unit/testcase.rb +476 -0
  68. data/test-unit/lib/test/unit/testresult.rb +89 -0
  69. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  70. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  71. data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
  72. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
  73. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
  74. data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
  75. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  76. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  77. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  78. data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
  79. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  80. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  81. data/test-unit/lib/test/unit/version.rb +7 -0
  82. data/test-unit/sample/adder.rb +13 -0
  83. data/test-unit/sample/subtracter.rb +12 -0
  84. data/test-unit/sample/test_adder.rb +20 -0
  85. data/test-unit/sample/test_subtracter.rb +20 -0
  86. data/test-unit/sample/test_user.rb +23 -0
  87. data/test-unit/test/collector/test-descendant.rb +133 -0
  88. data/test-unit/test/collector/test-load.rb +442 -0
  89. data/test-unit/test/collector/test_dir.rb +406 -0
  90. data/test-unit/test/collector/test_objectspace.rb +100 -0
  91. data/test-unit/test/run-test.rb +15 -0
  92. data/test-unit/test/test-attribute.rb +86 -0
  93. data/test-unit/test/test-color-scheme.rb +67 -0
  94. data/test-unit/test/test-color.rb +47 -0
  95. data/test-unit/test/test-diff.rb +518 -0
  96. data/test-unit/test/test-emacs-runner.rb +60 -0
  97. data/test-unit/test/test-fixture.rb +287 -0
  98. data/test-unit/test/test-notification.rb +33 -0
  99. data/test-unit/test/test-omission.rb +81 -0
  100. data/test-unit/test/test-pending.rb +70 -0
  101. data/test-unit/test/test-priority.rb +119 -0
  102. data/test-unit/test/test-testcase.rb +544 -0
  103. data/test-unit/test/test_assertions.rb +1151 -0
  104. data/test-unit/test/test_error.rb +26 -0
  105. data/test-unit/test/test_failure.rb +33 -0
  106. data/test-unit/test/test_testresult.rb +113 -0
  107. data/test-unit/test/test_testsuite.rb +129 -0
  108. data/test-unit/test/testunit-test-util.rb +14 -0
  109. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  110. data/test-unit/test/util/test-method-owner-finder.rb +38 -0
  111. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  112. data/test-unit/test/util/test_observable.rb +102 -0
  113. data/test-unit/test/util/test_procwrapper.rb +36 -0
  114. data/test/groonga-test-utils.rb +3 -2
  115. data/test/run-test.rb +14 -2
  116. data/test/test-column.rb +7 -7
  117. data/test/test-context-select.rb +34 -11
  118. data/test/test-exception.rb +3 -0
  119. data/test/test-expression-builder.rb +11 -0
  120. data/test/test-expression.rb +3 -6
  121. data/test/test-gqtp.rb +3 -5
  122. data/test/test-pagination.rb +249 -0
  123. data/test/test-record.rb +36 -8
  124. data/test/test-remote.rb +11 -4
  125. data/test/test-schema-create-table.rb +251 -0
  126. data/test/test-schema.rb +4 -24
  127. data/test/test-table-offset-and-limit.rb +3 -5
  128. data/test/test-table-select-mecab.rb +80 -0
  129. data/test/test-table-select-weight.rb +104 -0
  130. data/test/test-table.rb +22 -4
  131. data/test/test-version.rb +1 -1
  132. data/text/TUTORIAL.ja.rdoc +2 -0
  133. data/text/expression.rdoc +1 -0
  134. data/vendor/local/bin/grntest.exe +0 -0
  135. data/vendor/local/bin/groonga.exe +0 -0
  136. data/vendor/local/bin/libgroonga-0.dll +0 -0
  137. data/vendor/local/include/{groonga.h → groonga/groonga.h} +93 -32
  138. data/vendor/local/lib/groonga/modules/functions/cast.dll +0 -0
  139. data/vendor/local/lib/groonga/modules/functions/cast.la +41 -0
  140. data/vendor/local/lib/pkgconfig/groonga.pc +12 -0
  141. data/vendor/local/share/groonga/admin_html/css/admin.css +104 -0
  142. data/vendor/local/share/groonga/admin_html/css/ui-lightness/jquery-ui-1.8.1.custom.css +486 -0
  143. data/vendor/local/share/groonga/admin_html/index.html +1355 -0
  144. data/vendor/local/share/groonga/admin_html/js/jquery-1.4.2.min.js +154 -0
  145. data/vendor/local/share/groonga/admin_html/js/jquery-ui-1.8.1.custom.min.js +756 -0
  146. data/vendor/local/share/groonga/munin/plugins/groonga_cpu_load +47 -0
  147. data/vendor/local/share/groonga/munin/plugins/groonga_cpu_time +57 -0
  148. data/vendor/local/share/groonga/munin/plugins/groonga_disk +162 -0
  149. data/vendor/local/share/groonga/munin/plugins/groonga_memory +51 -0
  150. data/vendor/local/share/groonga/munin/plugins/groonga_n_records +110 -0
  151. data/vendor/local/share/groonga/munin/plugins/groonga_query_performance +133 -0
  152. data/vendor/local/share/groonga/munin/plugins/groonga_status +84 -0
  153. metadata +126 -36
@@ -0,0 +1,143 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ module Groonga
19
+ class TooSmallPage < Error
20
+ attr_reader :page, :available_pages
21
+ def initialize(page, available_pages)
22
+ @page = page
23
+ @available_pages = available_pages
24
+ super("too small page: #{@page}: " +
25
+ "available pages: #{@available_pages.inspect}")
26
+ end
27
+ end
28
+
29
+ class TooLargePage < Error
30
+ attr_reader :page, :available_pages
31
+ def initialize(page, available_pages)
32
+ @page = page
33
+ @available_pages = available_pages
34
+ super("too large page: #{@page}: " +
35
+ "available pages: #{@available_pages.inspect}")
36
+ end
37
+ end
38
+
39
+ class TooSmallPageSize < Error
40
+ attr_reader :page_size, :available_page_sizes
41
+ def initialize(page_size, available_page_sizes)
42
+ @page_size = page_size
43
+ @available_page_sizes = available_page_sizes
44
+ super("too small page size: #{@page_size}: " +
45
+ "available page sizes: #{@available_page_sizes.inspect}")
46
+ end
47
+ end
48
+
49
+ class Table
50
+ def paginate(sort_keys, options={})
51
+ _size = size
52
+ page_size = options[:size] || 10
53
+ minimum_size = [1, _size].min
54
+ if page_size < 1
55
+ raise TooSmallPageSize.new(page_size, minimum_size.._size)
56
+ end
57
+
58
+ max_page = [(_size / page_size.to_f).ceil, 1].max
59
+ page = options[:page] || 1
60
+ if page < 1
61
+ raise TooSmallPage.new(page, 1..max_page)
62
+ elsif max_page < page
63
+ raise TooLargePage.new(page, 1..max_page)
64
+ end
65
+
66
+ offset = (page - 1) * page_size
67
+ limit = page_size
68
+ records = sort(sort_keys, :offset => offset, :limit => limit)
69
+ records.extend(Pagination)
70
+ records.send(:set_pagination_info, page, page_size, _size)
71
+ records
72
+ end
73
+ end
74
+
75
+ # ページネーション機能を追加するモジュール。
76
+ #
77
+ # ページ番号など、0ベースではなく1ベースです。
78
+ module Pagination
79
+ attr_reader :current_page, :page_size, :n_pages, :n_records
80
+
81
+ def have_pages?
82
+ @n_pages > 1
83
+ end
84
+
85
+ def first_page
86
+ 1
87
+ end
88
+
89
+ def first_page?
90
+ @current_page == first_page
91
+ end
92
+
93
+ def last_page
94
+ @n_pages
95
+ end
96
+
97
+ def last_page?
98
+ @current_page == last_page
99
+ end
100
+
101
+ def have_next_page?
102
+ @current_page < @n_pages
103
+ end
104
+
105
+ def next_page
106
+ have_next_page? ? @current_page + 1 : nil
107
+ end
108
+
109
+ def have_previous_page?
110
+ @current_page > 1
111
+ end
112
+
113
+ def previous_page
114
+ have_previous_page? ? @current_page - 1 : nil
115
+ end
116
+
117
+ def n_records_in_page
118
+ size
119
+ end
120
+
121
+ def start_offset
122
+ return nil if @n_records.zero?
123
+ 1 + (@current_page - 1) * @page_size
124
+ end
125
+
126
+ def end_offset
127
+ return nil if @n_records.zero?
128
+ [start_offset + @page_size - 1, @n_records].min
129
+ end
130
+
131
+ def pages
132
+ first_page..last_page
133
+ end
134
+
135
+ private
136
+ def set_pagination_info(current_page, page_size, n_records)
137
+ @current_page = current_page
138
+ @page_size = page_size
139
+ @n_records = n_records
140
+ @n_pages = [(@n_records / @page_size.to_f).ceil, 1].max
141
+ end
142
+ end
143
+ end
@@ -15,6 +15,8 @@
15
15
  # License along with this library; if not, write to the Free Software
16
16
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
 
18
+ require 'English'
19
+
18
20
  module Groonga
19
21
  class Record
20
22
  # レコードが所属するテーブル
@@ -43,6 +43,77 @@ module Groonga
43
43
  # end
44
44
  # end
45
45
  class Schema
46
+ # スキーマ操作で発生する例外のスーパークラス。
47
+ class Error < Groonga::Error
48
+ end
49
+
50
+ # テーブルが存在しないときに発生する。
51
+ class TableNotExists < Error
52
+ attr_reader :name
53
+ def initialize(name)
54
+ @name = name
55
+ super("table doesn't exist: <#{@name}>")
56
+ end
57
+ end
58
+
59
+ # すでに存在するテーブルと違うオプションでテーブルを作ろ
60
+ # うとしたときに発生する。
61
+ class TableCreationWithDifferentOptions < Error
62
+ attr_reader :table, :options
63
+ def initialize(table, options)
64
+ @table = table
65
+ @options = options
66
+ super("creating table with differnt options: " +
67
+ "#{@table.inspect}: #{@options.inspect}")
68
+ end
69
+ end
70
+
71
+ # すでに存在するカラムと違うオプションでテーブルを作ろ
72
+ # うとしたときに発生する。
73
+ class ColumnCreationWithDifferentOptions < Error
74
+ attr_reader :column, :options
75
+ def initialize(column, options)
76
+ @column = column
77
+ @options = options
78
+ super("creating column with differnt option: " +
79
+ "#{@column.inspect}: #{@options.inspect}")
80
+ end
81
+ end
82
+
83
+ # 未知のインデックス対象を指定したときに発生する。
84
+ class UnknownIndexTarget < Error
85
+ attr_reader :target_name
86
+ def initialize(target_name)
87
+ @target_name = target_name
88
+ super("unknown index target: <#{@target_name}>")
89
+ end
90
+ end
91
+
92
+ # 未知のオプションを指定したときに発生する。
93
+ class UnknownOptions < Error
94
+ attr_reader :options, :unknown_keys, :available_keys
95
+ def initialize(options, unknown_keys, available_keys)
96
+ @options = options
97
+ @unknown_keys = unknown_keys
98
+ @available_keys = available_keys
99
+ message = "unknown keys are specified: #{u@nknown_keys.inspect}"
100
+ message << ": available keys: #{@available_keys.inspect}"
101
+ message << ": options: #{@options.inspect}"
102
+ super(message)
103
+ end
104
+ end
105
+
106
+ # 未知のテーブルの種類を指定したときに発生する。
107
+ class UnknownTableType < Error
108
+ attr_reader :type, :available_types
109
+ def initialize(type, available_types)
110
+ @type = type
111
+ @available_types = available_types
112
+ super("unknown table type: #{@type.inspect}: " +
113
+ "available types: #{@available_types.inspect}")
114
+ end
115
+ end
116
+
46
117
  class << self
47
118
 
48
119
  # call-seq:
@@ -144,11 +215,14 @@ module Groonga
144
215
  # ルにGroonga::IndexColumnを定義する場合は
145
216
  # <tt>"TokenBigram"</tt>などを指定する必要がある。
146
217
  #
147
- # 以下は+:type+に+:patricia_trie+を指定した時に指定可能。
218
+ # 以下は+:type+に+:hash+または+:patricia_trie+を指定し
219
+ # た時に指定可能。
148
220
  #
149
221
  # [+:key_normalize+]
150
222
  # +true+を指定するとキーを正規化する。
151
223
  #
224
+ # 以下は+:type+に+:patricia_trie+を指定した時に指定可能。
225
+ #
152
226
  # [+:key_with_sis+]
153
227
  # +true+を指定するとキーの文字列の全suffixが自動的に
154
228
  # 登録される。
@@ -569,11 +643,18 @@ module Groonga
569
643
  def define # :nodoc:
570
644
  table = context[@name]
571
645
  if @options[:change]
572
- raise ArgumentError, "table doesn't exist: #{@name}" if table.nil?
646
+ raise TableNotExists.new(@name) if table.nil?
573
647
  else
574
- if table and @options[:force]
575
- table.remove
576
- table = nil
648
+ if table
649
+ unless same_table?(table, create_options)
650
+ if @options[:force]
651
+ table.remove
652
+ table = nil
653
+ else
654
+ options = create_options
655
+ raise TableCreationWithDifferentOptions.new(table, options)
656
+ end
657
+ end
577
658
  end
578
659
  table ||= @table_type.create(create_options)
579
660
  end
@@ -832,9 +913,7 @@ module Groonga
832
913
  return if options.nil?
833
914
  unknown_keys = options.keys - AVAILABLE_OPTION_KEYS
834
915
  unless unknown_keys.empty?
835
- message = "unknown keys are specified: #{unknown_keys.inspect}"
836
- message << ": available keys: #{AVAILABLE_OPTION_KEYS.inspect}"
837
- raise ArgumentError, message
916
+ raise UnknownOptions.new(options, unknown_keys, AVAILABLE_OPTION_KEYS)
838
917
  end
839
918
  end
840
919
 
@@ -848,7 +927,7 @@ module Groonga
848
927
  when :patricia_trie
849
928
  Groonga::PatriciaTrie
850
929
  else
851
- raise ArgumentError, "unknown table type: #{type.inspect}"
930
+ raise UnknownTableType.new(type, [nil, :array, :hash, :patricia_trie])
852
931
  end
853
932
  end
854
933
 
@@ -863,6 +942,7 @@ module Groonga
863
942
  }
864
943
  key_support_table_common = {
865
944
  :key_type => Schema.normalize_type(@options[:key_type]),
945
+ :key_normalize => @options[:key_normalize],
866
946
  :default_tokenizer => @options[:default_tokenizer],
867
947
  }
868
948
 
@@ -872,12 +952,9 @@ module Groonga
872
952
  common.merge(key_support_table_common)
873
953
  elsif @table_type == Groonga::PatriciaTrie
874
954
  options = {
875
- :key_normalize => @options[:key_normalize],
876
955
  :key_with_sis => @options[:key_with_sis],
877
956
  }
878
957
  common.merge(key_support_table_common).merge(options)
879
- else
880
- raise ArgumentError, "unknown table type: #{@table_type.inspect}"
881
958
  end
882
959
  end
883
960
 
@@ -903,6 +980,44 @@ module Groonga
903
980
  definition.options.merge!(column_options.merge(options))
904
981
  self
905
982
  end
983
+
984
+ def same_table?(table, options)
985
+ return false unless table.class == @table_type
986
+ return false unless table.range == resolve_name(options[:value_type])
987
+ sub_records = options[:sub_records]
988
+ sub_records = false if sub_records.nil?
989
+ return false unless table.support_sub_records? == sub_records
990
+
991
+ case table
992
+ when Groonga::Array
993
+ true
994
+ when Groonga::Hash, Groonga::PatriciaTrie
995
+ return false unless table.domain == resolve_name(options[:key_type])
996
+ default_tokenizer = resolve_name(options[:default_tokenizer])
997
+ return false unless table.default_tokenizer == default_tokenizer
998
+ key_normalize = options[:key_normalize]
999
+ key_normalize = false if key_normalize.nil?
1000
+ return false unless table.normalize_key? == key_normalize
1001
+ if table.is_a?(Groonga::PatriciaTrie)
1002
+ key_with_sis = options[:key_with_sis]
1003
+ key_with_sis = false if key_with_sis.nil?
1004
+ return false unless table.register_key_with_sis? == key_with_sis
1005
+ end
1006
+ true
1007
+ else
1008
+ false
1009
+ end
1010
+ end
1011
+
1012
+ def resolve_name(type)
1013
+ if type.nil?
1014
+ nil
1015
+ elsif type.is_a?(String)
1016
+ context[type]
1017
+ else
1018
+ type
1019
+ end
1020
+ end
906
1021
  end
907
1022
 
908
1023
  class TableRemoveDefinition # :nodoc:
@@ -935,7 +1050,7 @@ module Groonga
935
1050
  def define # :nodoc:
936
1051
  view = context[@name]
937
1052
  if @options[:change]
938
- raise ArgumentError, "view doesn't exist: #{@name}" if view.nil?
1053
+ raise TableNotExists.new(@name) if view.nil?
939
1054
  else
940
1055
  if view and @options[:force]
941
1056
  view.remove
@@ -945,9 +1060,11 @@ module Groonga
945
1060
  end
946
1061
  _context = context
947
1062
  @tables.each do |table|
948
- _table = table
949
- table = context[table] unless table.is_a?(Groonga::Table)
950
- raise ArgumentError, "table doesn't exist: #{_table}" if table.nil?
1063
+ unless table.is_a?(Groonga::Table)
1064
+ table_name = table
1065
+ table = context[table_name]
1066
+ raise TableNotExists.new(table_name) if table.nil?
1067
+ end
951
1068
  view.add_table(table)
952
1069
  end
953
1070
  view
@@ -971,9 +1088,7 @@ module Groonga
971
1088
  return if options.nil?
972
1089
  unknown_keys = options.keys - AVAILABLE_OPTION_KEYS
973
1090
  unless unknown_keys.empty?
974
- message = "unknown keys are specified: #{unknown_keys.inspect}"
975
- message << ": available keys: #{AVAILABLE_OPTION_KEYS.inspect}"
976
- raise ArgumentError, message
1091
+ raise UnknownOptions.new(options, unknown_keys, AVAILABLE_OPTION_KEYS)
977
1092
  end
978
1093
  end
979
1094
 
@@ -1021,10 +1136,8 @@ module Groonga
1021
1136
  if @options.delete(:force)
1022
1137
  column.remove
1023
1138
  else
1024
- raise ArgumentError,
1025
- "the same name column with different type is " +
1026
- "already defined: #{@type.inspect}(#{@options.inspect}): " +
1027
- "#{column.inspect}"
1139
+ options = @options.merge(:type => @type)
1140
+ raise ColumnCreationWithDifferentOptions.new(column, options)
1028
1141
  end
1029
1142
  end
1030
1143
  table.define_column(@name,
@@ -1073,7 +1186,7 @@ module Groonga
1073
1186
  if target_table.nil? or
1074
1187
  !(@target_column == "_key" or
1075
1188
  target_table.have_column?(@target_column))
1076
- raise ArgumentError, "Unknown index target: <#{target_name}>"
1189
+ raise UnknownIndexTarget.new(target_name)
1077
1190
  end
1078
1191
  index = table.column(@name)
1079
1192
  if index
@@ -1081,11 +1194,9 @@ module Groonga
1081
1194
  if @options.delete(:force)
1082
1195
  index.remove
1083
1196
  else
1084
- raise ArgumentError,
1085
- "the same name index column with " +
1086
- "different target or options is " +
1087
- "already defined: #{target_name.inspect}" +
1088
- "(#{@options.inspect}): #{index.inspect}"
1197
+ options = @options.merge(:type => :index,
1198
+ :target_name => target_name)
1199
+ raise ColumnCreationWithDifferentOptions.new(index, options)
1089
1200
  end
1090
1201
  end
1091
1202
  index = table.define_index_column(@name,
@@ -0,0 +1,156 @@
1
+ = お知らせ
2
+
3
+ == 0.9.5: 2010-07-29
4
+
5
+ * groonga 0.7.4対応。
6
+ * Groonga::Table#selectの改良:
7
+ * 重み付きマッチ対応:
8
+
9
+ sourceカラムとtitleカラムにマッチするが、
10
+ titleカラムの方がスコアが大きくなる例:
11
+ table.select do |record|
12
+ (record.title * 10 | record.source) =~ "query"
13
+ end
14
+ * 配列で複数条件のand表現に対応:
15
+
16
+ 以下は同じ条件になる:
17
+ table.select do |record|
18
+ conditions = []
19
+ conditions << record.title =~ "query"
20
+ conditions << record.updated_at > Time.parse("2010-07-29T21:14:29+09:00")
21
+ conditions
22
+ end
23
+
24
+ table.select do |record|
25
+ (record.title =~ "query") &
26
+ (record.updated_at > Time.parse("2010-07-29T21:14:29+09:00"))
27
+ end
28
+ * 利用しているgroongaのバージョン取得対応: Groonga::VERSION
29
+ * Groonga::Table#support_sub_records?追加
30
+ * ページネーション対応: Groonga::Table#paginate, Groonga::Pagination
31
+
32
+ == 0.9.4: 2010-04-22
33
+
34
+ * リリースミス修正。
35
+
36
+ == 0.9.3: 2010-04-22
37
+
38
+ * リリースミス修正。
39
+
40
+ == 0.9.2: 2010-04-22
41
+
42
+ * groonga 0.1.9対応。
43
+ * たくさん。
44
+
45
+ == 0.9.1: 2010-02-09
46
+
47
+ * groonga 0.1.6対応
48
+
49
+ == 0.9.0: 2010-02-09
50
+
51
+ * groonga 0.1.5対応
52
+ * APIの追加
53
+ * Groonga::Object#context
54
+ * Groonga::Record#n_sub_records
55
+ * Groonga::Context#send
56
+ * Groonga::Context#receive
57
+ * Groonga::PatriciaTrie#prefix_search [Tasuku SUENAGA]
58
+ * Groonga::Object#path [Ryo Onodera]
59
+ * Groonga::Object#lock [Tasuku SUENAGA]
60
+ * Groonga::Object#unlock [Tasuku SUENAGA]
61
+ * Groonga::Object#locked? [Tasuku SUENAGA]
62
+ * Groonga::Object#temporary?
63
+ * Groonga::Object#persistent?
64
+ * Groonga::ObjectClosed
65
+ * Groonga::Context.[]
66
+ * Groonga::Table#column_value
67
+ * Groonga::Table#set_column_value
68
+ * APIの変更
69
+ * Groonga::Table#select, Groonga::Column#select
70
+ * Groonga::Expressionも受け付けるようになった
71
+ * grn式のシンタックスを指定する:syntaxオプションの追加
72
+ * Groonga::Table#open_cursor
73
+ * 開始位置を指定する:offsetオプションの追加
74
+ * 最大レコード数を指定する:limitオプションの追加
75
+ * Groonga::Expression.parseの引数を変更
76
+ * (nil (default) -> :column) -> (nil (default) -> :query)
77
+ * :column -> 廃止
78
+ * :table -> :query
79
+ * :table_query -> :query
80
+ * :expression -> :script
81
+ * :language -> :script
82
+ * Groonga::Table#define_column, Groonga::Table#define_index_column
83
+ * 永続テーブルをデフォルトにした
84
+ * Groonga::Table#[]をGroonga::Table#valueに変更
85
+ * Groonga::Table#[]=をGroonga::Table#set_valueに変更
86
+ * Groonga::Table#findをGroonga::Table#[]に変更
87
+ * Groonga::Table#findは非推奨
88
+ * Groonga::Table#[]=を削除
89
+ * Groonga::TableKeySupport#[]=はGroonga::TableKeySupport#addの別名
90
+ * Groonga::Recordで存在しないカラムにアクセスしたときの例外を
91
+ Groonga::InvalidArgumentからGroonga::NoSuchColumnに変更
92
+ * バグ修正
93
+ * スキーマにコンテキストが伝搬されない問題の修正 [dara]
94
+ * Groonga::PatriciaTrie#tag_keysが最後のテキストを返さない問題の修正
95
+ [Ryo Onodera]
96
+ * extconf.rbにデバッグモードでビルドする--with-debugオプションを追加
97
+ * Ruby 1.9.1でextconf.rbが失敗する問題の修正
98
+
99
+ === 感謝
100
+
101
+ * dara
102
+ * Ryo Onodera
103
+ * Tasuku SUENAGA
104
+
105
+ == 0.0.7: 2009-10-02
106
+
107
+ * groonga 0.1.4対応
108
+ * APIの追加
109
+ * Groonga::PatriciaTrie#scan
110
+ * Groonga::PatriciaTrie#tag_keys
111
+ * Groonga::Expression#snippet
112
+ * Groonga::Object#append
113
+ * Groonga::Object#prepend
114
+
115
+ == 0.0.6: 2009-07-31
116
+
117
+ * groonga 0.1.1対応
118
+ * ドキュメントの修正 [id:mat_aki]
119
+ * Groonga::Table#selectでのg式対応
120
+ * APIの追加
121
+ * Groonga::Table#union!
122
+ * Groonga::Table#intersect!
123
+ * Groonga::Table#differene!
124
+ * Groonga::Table#merge!
125
+ * tar.gzも提供 [id:m_seki]
126
+ * メモリリークの修正
127
+
128
+ == 0.0.3: 2009-07-18
129
+
130
+ * [#26145] Groonga::TableKeySupport#has_key?の追加 [Tasuku SUENAGA]
131
+ * [#26146] カラム名が存在しない場合はGroonga::Record#[]が例外
132
+ をあげるように変更 [Tasuku SUENAGA]
133
+ * 32ビット環境をサポート [niku]
134
+ * N-gramインデックスサーチのテストを追加 [dara]
135
+ * APIの追加
136
+ * Groonga::Record#incemrent!
137
+ * Groonga::Record#decemrent!
138
+ * Groonga::Record#lock
139
+ * Groonga::Table#lock
140
+ * Groonga::Schema: スキーマ定義用DSL
141
+ * Groonga::Expression
142
+
143
+ == 0.0.2: 2009-06-04
144
+
145
+ * groonga 0.0.8対応 [mori]
146
+ * 性能向上: キー、値、ドメイン、レンジをキャッシュ
147
+ * API改良
148
+ * ドキュメントの追加
149
+ * Ruby 1.9対応
150
+ * バグ修正:
151
+ * インストール処理の修正 [Tasuku SUENAGA]
152
+ * メモリリーク修正
153
+
154
+ == 0.0.1: 2009-04-30
155
+
156
+ * 最初のリリース!