rroonga 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/Rakefile +21 -2
  2. data/bin/grndump +3 -2
  3. data/ext/groonga/extconf.rb +1 -6
  4. data/ext/groonga/rb-grn-array.c +58 -31
  5. data/ext/groonga/rb-grn-column.c +220 -148
  6. data/ext/groonga/rb-grn-context.c +46 -32
  7. data/ext/groonga/rb-grn-database.c +102 -90
  8. data/ext/groonga/rb-grn-double-array-trie.c +205 -163
  9. data/ext/groonga/rb-grn-encoding-support.c +2 -3
  10. data/ext/groonga/rb-grn-encoding.c +13 -8
  11. data/ext/groonga/rb-grn-exception.c +1 -1
  12. data/ext/groonga/rb-grn-expression.c +110 -133
  13. data/ext/groonga/rb-grn-fix-size-column.c +5 -4
  14. data/ext/groonga/rb-grn-geo-point.c +55 -0
  15. data/ext/groonga/rb-grn-hash.c +120 -82
  16. data/ext/groonga/rb-grn-index-column.c +66 -70
  17. data/ext/groonga/rb-grn-index-cursor.c +3 -0
  18. data/ext/groonga/rb-grn-logger.c +33 -51
  19. data/ext/groonga/rb-grn-object.c +2 -0
  20. data/ext/groonga/rb-grn-operator.c +1 -1
  21. data/ext/groonga/rb-grn-patricia-trie.c +287 -232
  22. data/ext/groonga/rb-grn-plugin.c +11 -14
  23. data/ext/groonga/rb-grn-snippet.c +37 -54
  24. data/ext/groonga/rb-grn-table-cursor-key-support.c +3 -3
  25. data/ext/groonga/rb-grn-table-cursor.c +8 -6
  26. data/ext/groonga/rb-grn-table-key-support.c +22 -29
  27. data/ext/groonga/rb-grn-table.c +355 -279
  28. data/ext/groonga/rb-grn-type.c +18 -25
  29. data/ext/groonga/rb-grn-utils.c +77 -7
  30. data/ext/groonga/rb-grn-variable-size-column.c +12 -20
  31. data/ext/groonga/rb-grn-view.c +56 -51
  32. data/ext/groonga/rb-grn.h +28 -1
  33. data/ext/groonga/rb-groonga.c +1 -0
  34. data/lib/groonga.rb +2 -0
  35. data/lib/groonga/command.rb +3 -1
  36. data/lib/groonga/database.rb +27 -0
  37. data/lib/groonga/dumper.rb +96 -17
  38. data/lib/groonga/geo-point.rb +216 -0
  39. data/lib/groonga/schema.rb +29 -46
  40. data/rroonga-build.rb +1 -1
  41. data/rroonga.gemspec +90 -0
  42. data/test/groonga-test-utils.rb +168 -0
  43. data/test/run-test.rb +60 -0
  44. data/test/test-accessor.rb +36 -0
  45. data/test/test-array.rb +146 -0
  46. data/test/test-column.rb +350 -0
  47. data/test/test-command-select.rb +181 -0
  48. data/test/test-context.rb +130 -0
  49. data/test/test-database-dumper.rb +259 -0
  50. data/test/test-database.rb +173 -0
  51. data/test/test-double-array-trie.rb +189 -0
  52. data/test/test-encoding.rb +33 -0
  53. data/test/test-exception.rb +230 -0
  54. data/test/test-expression-builder.rb +602 -0
  55. data/test/test-expression.rb +134 -0
  56. data/test/test-fix-size-column.rb +77 -0
  57. data/test/test-geo-point.rb +190 -0
  58. data/test/test-gqtp.rb +70 -0
  59. data/test/test-hash.rb +367 -0
  60. data/test/test-index-column.rb +180 -0
  61. data/test/test-index-cursor.rb +123 -0
  62. data/test/test-logger.rb +37 -0
  63. data/test/test-pagination.rb +249 -0
  64. data/test/test-patricia-trie.rb +440 -0
  65. data/test/test-plugin.rb +35 -0
  66. data/test/test-procedure.rb +37 -0
  67. data/test/test-query-log.rb +258 -0
  68. data/test/test-record.rb +577 -0
  69. data/test/test-remote.rb +63 -0
  70. data/test/test-schema-create-table.rb +267 -0
  71. data/test/test-schema-dumper.rb +235 -0
  72. data/test/test-schema-type.rb +208 -0
  73. data/test/test-schema-view.rb +90 -0
  74. data/test/test-schema.rb +886 -0
  75. data/test/test-snippet.rb +130 -0
  76. data/test/test-table-dumper.rb +353 -0
  77. data/test/test-table-offset-and-limit.rb +100 -0
  78. data/test/test-table-select-mecab.rb +80 -0
  79. data/test/test-table-select-normalize.rb +57 -0
  80. data/test/test-table-select-weight.rb +123 -0
  81. data/test/test-table-select.rb +191 -0
  82. data/test/test-table-traverse.rb +304 -0
  83. data/test/test-table.rb +711 -0
  84. data/test/test-type.rb +79 -0
  85. data/test/test-variable-size-column.rb +147 -0
  86. data/test/test-variable.rb +28 -0
  87. data/test/test-vector-column.rb +76 -0
  88. data/test/test-version.rb +61 -0
  89. data/test/test-view.rb +72 -0
  90. metadata +330 -202
@@ -65,23 +65,20 @@ rb_grn_plugin_alloc (VALUE klass)
65
65
  }
66
66
 
67
67
  /*
68
- * call-seq:
69
- * Groonga::Plugin.register(name, options=nil)
70
- * Groonga::Plugin.register({:path => path, :context => nil})
71
- *
72
68
  * 既存のプラグインをデータベースに登録する。
73
69
  *
74
- * _name_ を指定した場合はその名前のプラグインを登録する。
75
- *
76
- * _path_ を指定した場合はそのパスのプラグインを登録する。
77
- *
78
- * _options_ にはハッシュでオプションを指定する。指定できるオ
79
- * プションは以下の通り。
80
- * @param options [::Hash] The name and value
81
- * pairs. Omitted names are initialized as the default value.
82
- * @option options :context (Groonga::Context.default) The context
70
+ * @overload register(name, options=nil)
71
+ * _name_ で指定した名前のプラグインを登録する。
72
+ * @param [String] name 登録するプラグインの名前
73
+ * @param options [::Hash] The name and value
74
+ * pairs. Omitted names are initialized as the default value.
75
+ * @option options :context (Groonga::Context.default)
76
+ * データベースを結びつけるコンテキスト。
77
+ * @overload register({:path => path, :context => nil})
78
+ * @param hash [::Hash] _:path_ _:context_ を指定したハッシュを指定する。
79
+ * _:path_ で指定したパスのプラグインを登録する。
83
80
  *
84
- * データベースを結びつけるコンテキスト。
81
+ * _:context_ については _name_ を設定した時と同様。
85
82
  */
86
83
  static VALUE
87
84
  rb_grn_plugin_s_register (int argc, VALUE *argv, VALUE klass)
@@ -55,43 +55,29 @@ rb_grn_snippet_deconstruct (RbGrnSnippet *rb_grn_snippet,
55
55
  }
56
56
 
57
57
  /*
58
- * call-seq:
59
- * Groonga::Snippet.new(options={})
58
+ * スニペットを作成する。
60
59
  *
61
- * スニペットを作成する。 _options_ に指定可能な値は以下の通
62
- * り。
63
- * @param options [::Hash] The name and value
64
- * pairs. Omitted names are initialized as the default value.
65
- * @option options :context (Groonga::Context.default) The context
66
- *
67
- * スキーマ作成時に使用するGroonga::Contextを指定する。
68
- *
69
- * @option options :normalize The normalize
70
- *
71
- * キーワード文字列・スニペット元の文字列を正規化するかど
72
- * うか。省略した場合は +false+ で正規化しない。
73
- *
74
- * @option options :skip_leading_spaces (false) The skip_leading_spaces
75
- *
76
- * 先頭の空白を無視するかどうか。省略した場合は で無
77
- * 視しない。
78
- *
79
- * @option options :width (100) The width
80
- *
81
- * スニペット文字列の長さ。省略した場合は100文字。
82
- *
83
- * @option options :max_results (3) The max_results
84
- * 生成するスニペットの最大数。省略した場合は3。
85
- *
86
- * @option options :html_escape (false) The html_escape
87
- * スニペット内の+<+, +>+, +&+, +"+をHTMLエスケープするか
88
- * どうか。省略した場合は+false+で、HTMLエスケープしない。
89
- *
90
- * @option options :default_open_tag ("") The default_open_tag
91
- * デフォルトの開始タグ。省略した場合は""(空文字列)
92
- *
93
- * @option options :default_close_tag ("") The default_close_tag
94
- * デフォルトの終了タグ。省略した場合は""(空文字列)
60
+ * @overload new(options={})
61
+ * @param options [::Hash] The name and value
62
+ * pairs. Omitted names are initialized as the default value.
63
+ * @option options :context (Groonga::Context.default)
64
+ * スキーマ作成時に使用するGroonga::Contextを指定する。
65
+ * @option options :normalize
66
+ * キーワード文字列・スニペット元の文字列を正規化するかどうか。
67
+ * 省略した場合は +false+ で正規化しない。
68
+ * @option options :skip_leading_spaces (false)
69
+ * 先頭の空白を無視するかどうか。省略した場合は +false+ で無視しない。
70
+ * @option options :width (100)
71
+ * スニペット文字列の長さ。省略した場合は100文字。
72
+ * @option options :max_results (3)
73
+ * 生成するスニペットの最大数。省略した場合は3。
74
+ * @option options :html_escape (false)
75
+ * スニペット内の +<+ , +>+ , +&+ , +"+ をHTMLエスケープするかどうか。
76
+ * 省略した場合は +false+ で、HTMLエスケープしない。
77
+ * @option options :default_open_tag ("")
78
+ * デフォルトの開始タグ。省略した場合は""(空文字列)
79
+ * @option options :default_close_tag ("")
80
+ * デフォルトの終了タグ。省略した場合は""(空文字列)
95
81
  */
96
82
  static VALUE
97
83
  rb_grn_snippet_initialize (int argc, VALUE *argv, VALUE self)
@@ -165,22 +151,18 @@ rb_grn_snippet_initialize (int argc, VALUE *argv, VALUE self)
165
151
  }
166
152
 
167
153
  /*
168
- * call-seq:
169
- * snippet.add_keyword(keyword, options={})
170
- *
171
- * _keyword_ を追加する。 _options_ に指定可能な値は
172
- * 以下の通り。
173
- * @param options [::Hash] The name and value
174
- * pairs. Omitted names are initialized as the default value.
175
- * @option options :open_tag (default_open_tag) The open_tag
154
+ * _keyword_ を追加する。
176
155
  *
177
- * 開始タグ。省略した場合はGroonga::Snippet.newで指定し
178
- * た+:default_open_tag+。
179
- *
180
- * @option options :close_tag (:default_close_tag) The close_tag
181
- *
182
- * 終了タグ。省略した場合はGroonga::Snippet.newで指定し
183
- * た+:default_close_tag+。
156
+ * @overload add_keyword(keyword, options={})
157
+ * @param [String] keyword 追加するキーワード
158
+ * @param options [::Hash] The name and value
159
+ * pairs. Omitted names are initialized as the default value.
160
+ * @option options :open_tag (default_open_tag)
161
+ * 開始タグ。省略した場合はGroonga::Snippet.newで指定した
162
+ * +:default_open_tag+ 。
163
+ * @option options :close_tag (:default_close_tag)
164
+ * 終了タグ。省略した場合はGroonga::Snippet.newで指定した
165
+ * +:default_close_tag+ 。
184
166
  */
185
167
  static VALUE
186
168
  rb_grn_snippet_add_keyword (int argc, VALUE *argv, VALUE self)
@@ -225,10 +207,11 @@ rb_grn_snippet_add_keyword (int argc, VALUE *argv, VALUE self)
225
207
  }
226
208
 
227
209
  /*
228
- * call-seq:
229
- * snippet.execute(string) -> スニペットの配列
230
- *
231
210
  * _string_ を走査し、スニペットを作成する。
211
+ *
212
+ * @overload execute(string)
213
+ * @param [String] string 走査する文字列
214
+ * @return [::Array] 作成されたスニペットの配列
232
215
  */
233
216
  static VALUE
234
217
  rb_grn_snippet_execute (VALUE self, VALUE rb_string)
@@ -31,10 +31,10 @@ VALUE rb_mGrnTableCursorKeySupport;
31
31
  */
32
32
 
33
33
  /*
34
- * call-seq:
35
- * cursor.key -> 主キー
36
- *
37
34
  * カレントレコードの主キーを返す。
35
+ *
36
+ * @overload key
37
+ * @return [::Object] カレントレコードの主キー
38
38
  */
39
39
  static VALUE
40
40
  rb_grn_table_cursor_get_key (VALUE self)
@@ -125,10 +125,10 @@ rb_grn_table_cursor_order_by_to_flag (unsigned char table_type,
125
125
  }
126
126
 
127
127
  /*
128
- * call-seq:
129
- * cursor.value -> 値
130
- *
131
128
  * カレントレコードの値を返す。
129
+ *
130
+ * @overload value
131
+ * @return [String] カレントレコードの値
132
132
  */
133
133
  static VALUE
134
134
  rb_grn_table_cursor_get_value (VALUE self)
@@ -151,10 +151,10 @@ rb_grn_table_cursor_get_value (VALUE self)
151
151
  }
152
152
 
153
153
  /*
154
- * call-seq:
155
- * cursor.value = 値
156
- *
157
154
  * カレントレコードの値を設定する。既存の値は上書きされる。
155
+ *
156
+ * @overload value=(value)
157
+ * @param [String] value カレントレコードに設定する値
158
158
  */
159
159
  static VALUE
160
160
  rb_grn_table_cursor_set_value (VALUE self, VALUE value)
@@ -241,6 +241,8 @@ rb_grn_table_cursor_each (VALUE self)
241
241
  grn_ctx *context;
242
242
  grn_table_cursor *cursor;
243
243
 
244
+ RETURN_ENUMERATOR(self, 0, NULL);
245
+
244
246
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
245
247
  NULL, NULL, NULL, NULL);
246
248
 
@@ -300,14 +300,12 @@ rb_grn_table_key_support_delete (VALUE self, VALUE rb_id_or_key)
300
300
  }
301
301
 
302
302
  /*
303
- * Document-method: []
304
- *
305
- * call-seq:
306
- * table[key] -> Groonga::Record
307
- *
308
303
  * _table_ の _key_ に対応するGroonga::Recordを返す。
309
304
  *
310
305
  * 0.9.0から値ではなくGroonga::Recordを返すようになった。
306
+ *
307
+ * @overload [](key)
308
+ * @return [Groonga::Record]
311
309
  */
312
310
  static VALUE
313
311
  rb_grn_table_key_support_array_reference (VALUE self, VALUE rb_key)
@@ -352,15 +350,14 @@ set_value (VALUE args, SetValueData *data)
352
350
  }
353
351
 
354
352
  /*
355
- * Document-method: []=
356
- *
357
- * call-seq:
358
- * table[key] = {:column_name => value, ...}
359
- *
360
353
  * _table_ の _key_ に対応するカラム _column_name_ の値を設定する。
361
354
  * _key_ に対応するレコードがない場合は新しく作成される。
362
355
  *
363
356
  * 0.9.0から値ではなくカラムの値を設定するようになった。
357
+ *
358
+ * @overload []=(key, values)
359
+ * @param [::Hash] values
360
+ * keyに対応させるカラムの値。{ :column_name => value, ... }の形で設定する。
364
361
  */
365
362
  static VALUE
366
363
  rb_grn_table_key_support_array_set (VALUE self, VALUE rb_key, VALUE rb_values)
@@ -393,12 +390,11 @@ rb_grn_table_key_support_array_set (VALUE self, VALUE rb_key, VALUE rb_values)
393
390
  }
394
391
 
395
392
  /*
396
- * call-seq:
397
- * table.set_column_value(key, name, value)
398
- * table.set_column_value(id, name, value, :id => true)
399
- *
400
393
  * _table_ の _key_ に対応するカラム _name_ の値を設定する。
401
394
  * _key_ に対応するレコードがない場合は新しく作成される。
395
+ *
396
+ * @overload set_column_value(key, name, value)
397
+ * @overload set_column_value(id, name, value, {:id=>true})
402
398
  */
403
399
  static VALUE
404
400
  rb_grn_table_key_support_set_column_value (int argc, VALUE *argv, VALUE self)
@@ -433,13 +429,12 @@ rb_grn_table_key_support_set_column_value (int argc, VALUE *argv, VALUE self)
433
429
  }
434
430
 
435
431
  /*
436
- * call-seq:
437
- * table.column_value(key, name)
438
- * table.column_value(id, name, :id => true)
439
- *
440
432
  * _table_ の _key_ に対応するカラム _name_ の値を設定する。
441
433
  *
442
434
  * TODO: _key_ に対応するレコードがない場合は例外?
435
+ *
436
+ * @overload column_value(key, name)
437
+ * @overload column_value(id, name, :id=>true)
443
438
  */
444
439
  static VALUE
445
440
  rb_grn_table_key_support_get_column_value (int argc, VALUE *argv, VALUE self)
@@ -492,11 +487,11 @@ rb_grn_table_key_support_get_value_by_key (VALUE self, VALUE rb_key)
492
487
  }
493
488
 
494
489
  /*
495
- * call-seq:
496
- * table.value(id, :id => true) -> 値
497
- * table.value(key) -> 値
498
- *
499
490
  * _table_ の _id_ または _key_ に対応する値を返す。
491
+ *
492
+ * @overload value(id, :id=>true)
493
+ * @overload value(key)
494
+ * @return _id_ もしくは _key_ に対応する値
500
495
  */
501
496
  static VALUE
502
497
  rb_grn_table_key_support_get_value (int argc, VALUE *argv, VALUE self)
@@ -562,12 +557,11 @@ rb_grn_table_key_support_set_value_by_key (VALUE self,
562
557
  }
563
558
 
564
559
  /*
565
- * call-seq:
566
- * table.set_value(id, value, :id => true)
567
- * table.set_value(key, value)
568
- *
569
560
  * _table_ の _id_ または _key_ に対応する値を _value_ に設定する。
570
561
  * 既存の値は上書きされる。
562
+ *
563
+ * @overload set_value(id, value, :id=>true)
564
+ * @overload set_value(key, value)
571
565
  */
572
566
  static VALUE
573
567
  rb_grn_table_key_support_set_value (int argc, VALUE *argv, VALUE self)
@@ -623,9 +617,6 @@ rb_grn_table_key_support_get_default_tokenizer (VALUE self)
623
617
  }
624
618
 
625
619
  /*
626
- * call-seq:
627
- * table.default_tokenizer = トークナイザ
628
- *
629
620
  * Groonga::IndexColumnで使用するトークナイザを設定する。
630
621
  *
631
622
  * @example
@@ -643,6 +634,8 @@ rb_grn_table_key_support_get_default_tokenizer (VALUE self)
643
634
  *
644
635
  * # MeCabを使用
645
636
  * table.default_tokenizer = "TokenMecab"
637
+ *
638
+ * @overload default_tokenizer=(tokenizer)
646
639
  */
647
640
  static VALUE
648
641
  rb_grn_table_key_support_set_default_tokenizer (VALUE self, VALUE rb_tokenizer)
@@ -224,36 +224,31 @@ rb_grn_table_inspect (VALUE self)
224
224
  }
225
225
 
226
226
  /*
227
- * call-seq:
228
- * table.define_column(name, value_type, options={}) ->
229
- * Groonga::FixSizeColumnかGroonga::VariableSizeColumn
230
- *
231
227
  * テーブルに名前が _name_ で型が _value_type_ のカラムを定義
232
228
  * し、新しく定義されたカラムを返す。
233
229
  *
234
- * _options_ に指定可能な値は以下の通り。
235
- * @param options [::Hash] The name and value
236
- * pairs. Omitted names are initialized as the default value.
237
- * @option options :path The path
238
- * カラムを保存するパス。
239
- *
240
- * @option options :persistent (永続カラム) The persistent
241
- * +true+ を指定すると永続カラムとなる。省略した場合は永
242
- * 続カラムとなる。 +:path+ を省略した場合は自動的にパスが
243
- * 付加される。
244
- *
245
- * @option options :type (:scalar) The type
246
- * カラムの値の格納方法について指定する。省略した場合は、
247
- * +:scalar+ になる。
248
- *
249
- * [+:scalar+] スカラ値(単独の値)を格納する。
250
- * [+:vector+] 値の配列を格納する。
251
- *
252
- * @param options :compress The compress
253
- * 値の圧縮方法を指定する。省略した場合は、圧縮しない。
254
- *
255
- * [+:zlib+] 値をzlib圧縮して格納する。
256
- * [+:lzo+] 値をlzo圧縮して格納する。
230
+ * @overload define_column(name, value_type, options={})
231
+ * @param options [::Hash] The name and value
232
+ * pairs. Omitted names are initialized as the default value.
233
+ * @option options :path
234
+ * カラムを保存するパス。
235
+ * @option options :persistent (永続カラム)
236
+ * +true+ を指定すると永続カラムとなる。省略した場合は永
237
+ * 続カラムとなる。 +:path+ を省略した場合は自動的にパスが
238
+ * 付加される。
239
+ * @option options :type (:scalar)
240
+ * カラムの値の格納方法について指定する。省略した場合は、
241
+ * +:scalar+ になる。
242
+ *
243
+ * [+:scalar+] スカラ値(単独の値)を格納する。
244
+ * [+:vector+] 値の配列を格納する。
245
+ * @option options :compress
246
+ * 値の圧縮方法を指定する。省略した場合は、圧縮しない。
247
+ *
248
+ * [+:zlib+] 値をzlib圧縮して格納する。
249
+ * [+:lzo+] 値をlzo圧縮して格納する。
250
+ *
251
+ * @return [Groonga::FixSizeColumn or Groonga::VariableSizeColumn]
257
252
  */
258
253
  static VALUE
259
254
  rb_grn_table_define_column (int argc, VALUE *argv, VALUE self)
@@ -364,37 +359,30 @@ n_gram_tokenizer_p(grn_ctx *context, grn_obj *tokenizer)
364
359
  }
365
360
 
366
361
  /*
367
- * call-seq:
368
- * table.define_index_column(name, value_type, options={}) -> Groonga::IndexColumn
369
- *
370
362
  * テーブルに名前が _name_ で型が _value_type_ のインデックスカ
371
363
  * ラムを定義し、新しく定義されたカラムを返す。
372
364
  *
373
- * _options_ に指定可能な値は以下の通り。
374
- * @param options [::Hash] The name and value
375
- * pairs. Omitted names are initialized as the default value.
376
- * @option options :path The path
377
- * カラムを保存するパス。
378
- *
379
- * @option options :persistent (永続カラム) The persistent
380
- * +true+ を指定すると永続カラムとなる。省略した場合は永
381
- * 続カラムとなる。 +:path+ を省略した場合は自動的にパスが
382
- * 付加される。
383
- *
384
- * @option options :with_section The with_section
385
- * 転置索引にsection(段落情報)を合わせて格納する。
386
- *
387
- * @option options :with_weight The with_weight
388
- * 転置索引にweight情報を合わせて格納する。
389
- *
390
- * @option options :with_position The with_position
391
- * 転置索引に出現位置情報を合わせて格納する。
392
- *
393
- * @option options :source The source
394
- * インデックス対象となるカラムを指定する。 +:sources+ との併用はできない。
395
- *
396
- * @option options :sources The sources
397
- * インデックス対象となる複数のカラムを指定する。 +:source+ との併用はできない。
365
+ * @overload define_index_column(name, value_type, options={})
366
+ * @param options [::Hash] The name and value
367
+ * pairs. Omitted names are initialized as the default value.
368
+ * @option options :path
369
+ * カラムを保存するパス。
370
+ * @option options :persistent (永続カラム)
371
+ * +true+ を指定すると永続カラムとなる。省略した場合は永
372
+ * 続カラムとなる。 +:path+ を省略した場合は自動的にパスが
373
+ * 付加される。
374
+ * @option options :with_section
375
+ * 転置索引にsection(段落情報)を合わせて格納する。
376
+ * @option options :with_weight
377
+ * 転置索引にweight情報を合わせて格納する。
378
+ * @option options :with_position
379
+ * 転置索引に出現位置情報を合わせて格納する。
380
+ * @option options :source
381
+ * インデックス対象となるカラムを指定する。 +:sources+ との併用はできない。
382
+ * @option options :sources
383
+ * インデックス対象となる複数のカラムを指定する。 +:source+ との併用はできない。
384
+ *
385
+ * @return [Groonga::IndexColumn]
398
386
  */
399
387
  static VALUE
400
388
  rb_grn_table_define_index_column (int argc, VALUE *argv, VALUE self)
@@ -619,6 +607,7 @@ rb_grn_table_get_columns (int argc, VALUE *argv, VALUE self)
619
607
  VALUE rb_name, rb_columns;
620
608
  char *name = NULL;
621
609
  unsigned name_size = 0;
610
+ VALUE exception;
622
611
 
623
612
  rb_grn_table_deconstruct(SELF(self), &table, &context,
624
613
  NULL, NULL,
@@ -655,6 +644,13 @@ rb_grn_table_get_columns (int argc, VALUE *argv, VALUE self)
655
644
  grn_table_cursor_get_key(context, cursor, &key);
656
645
  column_id = key;
657
646
  column = grn_ctx_at(context, *column_id);
647
+ exception = rb_grn_context_to_exception(context, self);
648
+ if (!NIL_P(exception)) {
649
+ grn_table_cursor_close(context, cursor);
650
+ grn_obj_unlink(context, columns);
651
+ rb_exc_raise(exception);
652
+ }
653
+
658
654
  rb_column = GRNOBJECT2RVAL(Qnil, context, column, GRN_FALSE);
659
655
  rb_ary_push(rb_columns, rb_column);
660
656
  }
@@ -762,54 +758,74 @@ rb_grn_table_open_grn_cursor (int argc, VALUE *argv, VALUE self,
762
758
  }
763
759
 
764
760
  /*
765
- * call-seq:
766
- * table.open_cursor(options={}) -> Groonga::TableCursor
767
- * table.open_cursor(options={}) {|cursor| }
768
- *
769
761
  * カーソルを生成して返す。ブロックを指定すると、そのブロッ
770
762
  * クに生成したカーソルが渡され、ブロックを抜けると自動的に
771
763
  * カーソルが破棄される。
772
764
  *
773
- * _options_に指定可能な値は以下の通り。
774
- * @param options [::Hash] The name and value
775
- * pairs. Omitted names are initialized as the default value.
776
- * @option options :min The min
777
- * キーの下限
778
- *
779
- * @option options :max The max
780
- * キーの上限
781
- *
782
- * @option options :offset The offset
783
- * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
784
- * からレコードを取り出す。
785
- *
786
- * @option options :limit The limit
787
- * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
788
- * 省略された場合または-1が指定された場合は、全件が指定され
789
- * たものとみなす。
790
- *
791
- * @option options :order (asc) The order
792
- * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
793
- * り出す。(デフォルト)
794
- *
795
- * +:desc+ または +:descending+ を指定すると降順にレコードを
796
- * 取り出す。
797
- *
798
- * @option options :order_by The order_by
799
- * +:id+ を指定するとID順にレコードを取り出す。(Arrayと
800
- * Hashのデフォルト)
801
- *
802
- * +:key+ 指定するとキー順にレコードを取り出す。ただし、
803
- * Groonga::PatriciaTrieにしか使えない。(PatriciaTrieのデ
804
- * フォルト)
805
- *
806
- * @option options :greater_than The greater_than
807
- * +true+ を指定すると +:min+ で指定した値に一致した [ +key+ ] を
808
- * 範囲に含まない。
809
- *
810
- * @option options :less_than The less_than
811
- * +true+ を指定すると +:max+ で指定した値に一致した [ +key+ ] を
812
- * 範囲に含まない。
765
+ * @overload open_cursor(options={})
766
+ * @return [Groonga::TableCursor]
767
+ * @param options [::Hash] The name and value
768
+ * pairs. Omitted names are initialized as the default value.
769
+ * @option options :min
770
+ * キーの下限
771
+ * @option options :max
772
+ * キーの上限
773
+ * @option options :offset
774
+ * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
775
+ * からレコードを取り出す。
776
+ * @option options :limit
777
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
778
+ * 省略された場合または-1が指定された場合は、全件が指定され
779
+ * たものとみなす。
780
+ * @option options :order (asc)
781
+ * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
782
+ * り出す。(デフォルト)
783
+ * +:desc+ または +:descending+ を指定すると降順にレコードを
784
+ * 取り出す。
785
+ * @option options :order_by
786
+ * +:id+ を指定するとID順にレコードを取り出す。(Arrayと
787
+ * Hashのデフォルト)
788
+ * +:key+ 指定するとキー順にレコードを取り出す。ただし、
789
+ * Groonga::PatriciaTrieにしか使えない。(PatriciaTrieのデ
790
+ * フォルト)
791
+ * @option options :greater_than The greater_than
792
+ * +true+ を指定すると +:min+ で指定した値に一致した [ +key+ ] を
793
+ * 範囲に含まない。
794
+ * @option options :less_than
795
+ * +true+ を指定すると +:max+ で指定した値に一致した [ +key+ ] を
796
+ * 範囲に含まない。
797
+ * @overload open_cursor(options={})
798
+ * @yield [cursor]
799
+ * @param options [::Hash] The name and value
800
+ * pairs. Omitted names are initialized as the default value.
801
+ * @option options :min
802
+ * キーの下限
803
+ * @option options :max
804
+ * キーの上限
805
+ * @option options :offset
806
+ * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
807
+ * からレコードを取り出す。
808
+ * @option options :limit
809
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
810
+ * 省略された場合または-1が指定された場合は、全件が指定され
811
+ * たものとみなす。
812
+ * @option options :order (asc)
813
+ * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
814
+ * り出す。(デフォルト)
815
+ * +:desc+ または +:descending+ を指定すると降順にレコードを
816
+ * 取り出す。
817
+ * @option options :order_by
818
+ * +:id+ を指定するとID順にレコードを取り出す。(Arrayと
819
+ * Hashのデフォルト)
820
+ * +:key+ 指定するとキー順にレコードを取り出す。ただし、
821
+ * Groonga::PatriciaTrieにしか使えない。(PatriciaTrieのデ
822
+ * フォルト)
823
+ * @option options :greater_than The greater_than
824
+ * +true+ を指定すると +:min+ で指定した値に一致した [ +key+ ] を
825
+ * 範囲に含まない。
826
+ * @option options :less_than
827
+ * +true+ を指定すると +:max+ で指定した値に一致した [ +key+ ] を
828
+ * 範囲に含まない。
813
829
  */
814
830
  static VALUE
815
831
  rb_grn_table_open_cursor (int argc, VALUE *argv, VALUE self)
@@ -853,10 +869,10 @@ rb_grn_table_get_records (int argc, VALUE *argv, VALUE self)
853
869
  }
854
870
 
855
871
  /*
856
- * call-seq:
857
- * table.size -> レコード数
858
- *
859
872
  * テーブルに登録されているレコード数を返す。
873
+ *
874
+ * @overload size
875
+ * @return [Integer] レコード数
860
876
  */
861
877
  static VALUE
862
878
  rb_grn_table_get_size (VALUE self)
@@ -937,6 +953,8 @@ rb_grn_table_each (int argc, VALUE *argv, VALUE self)
937
953
  VALUE rb_cursor;
938
954
  grn_id id;
939
955
 
956
+ RETURN_ENUMERATOR(self, argc, argv);
957
+
940
958
  cursor = rb_grn_table_open_grn_cursor(argc, argv, self, &context);
941
959
  rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
942
960
  rb_table = SELF(self);
@@ -977,10 +995,7 @@ rb_grn_table_delete (VALUE self, VALUE rb_id)
977
995
  }
978
996
 
979
997
  /*
980
- * call-seq:
981
- * table.sort(keys, options={}) -> Groonga::Recordの配列
982
- *
983
- * テーブルに登録されているレコードを_keys_で指定されたルー
998
+ * テーブルに登録されているレコードを _keys_ で指定されたルー
984
999
  * ルに従ってソートしたレコードの配列を返す。
985
1000
  *
986
1001
  * _order_ には +:asc+ , +:ascending+ , +:desc+ , +:descending+ の
@@ -1022,16 +1037,17 @@ rb_grn_table_delete (VALUE self, VALUE rb_id)
1022
1037
  * </pre>
1023
1038
  * =:
1024
1039
  *
1025
- * @param options [::Hash] The name and value
1026
- * pairs. Omitted names are initialized as the default value.
1027
- * @option options :offset The offset
1028
- * ソートされたレコードのうち、(0ベースで) _:offset_ 番目
1029
- * からレコードを取り出す。
1030
- *
1031
- * @option options :limit The limit
1032
- * ソートされたレコードのうち、 _:limit_ 件のみを取り出す。
1033
- * 省略された場合または-1が指定された場合は、全件が指定され
1034
- * たものとみなす。
1040
+ * @overload sort(keys, options={})
1041
+ * @param options [::Hash] The name and value
1042
+ * pairs. Omitted names are initialized as the default value.
1043
+ * @option options :offset
1044
+ * ソートされたレコードのうち、(0ベースで) _:offset_ 番目
1045
+ * からレコードを取り出す。
1046
+ * @option options :limit
1047
+ * ソートされたレコードのうち、 _:limit_ 件のみを取り出す。
1048
+ * 省略された場合または-1が指定された場合は、全件が指定され
1049
+ * たものとみなす。
1050
+ * @return [::Array<Groonga::Record>]
1035
1051
  */
1036
1052
  static VALUE
1037
1053
  rb_grn_table_sort (int argc, VALUE *argv, VALUE self)
@@ -1550,30 +1566,32 @@ rb_grn_table_unlock_ensure (VALUE self)
1550
1566
  }
1551
1567
 
1552
1568
  /*
1553
- * Document-method: lock
1554
- *
1555
- * call-seq:
1556
- * table.lock(options={})
1557
- * table.lock(options={}) {}
1558
- *
1559
1569
  * _table_ をロックする。ロックに失敗した場合は
1560
1570
  * Groonga::ResourceDeadlockAvoided例外が発生する。
1561
1571
  *
1562
1572
  * ブロックを指定した場合はブロックを抜けたときにunlockする。
1563
1573
  *
1564
- * 利用可能なオプションは以下の通り。
1565
- * @param options [::Hash] The name and value
1566
- * pairs. Omitted names are initialized as the default value.
1567
- * @option options :timeout The timeout
1568
- *
1569
- * ロックを獲得できなかった場合は _:timeout_ 秒間ロックの獲
1570
- * 得を試みる。 _:timeout_ 秒以内にロックを獲得できなかった
1571
- * 場合は例外が発生する。
1572
- *
1573
- * @option options :id The id
1574
- *
1575
- * _:id_ で指定したレコードをロックする。(注: groonga側が
1576
- * 未実装のため、現在は無視される)
1574
+ * @overload lock(options={})
1575
+ * @param options [::Hash] The name and value
1576
+ * pairs. Omitted names are initialized as the default value.
1577
+ * @option options :timeout
1578
+ * ロックを獲得できなかった場合は _:timeout_ 秒間ロックの獲
1579
+ * 得を試みる。 _:timeout_ 秒以内にロックを獲得できなかった
1580
+ * 場合は例外が発生する。
1581
+ * @option options :id
1582
+ * _:id_ で指定したレコードをロックする。(注: groonga側が
1583
+ * 未実装のため、現在は無視される)
1584
+ * @overload lock(options={})
1585
+ * @yield ブロックを抜けたときにunlockする。
1586
+ * @param options [::Hash] The name and value
1587
+ * pairs. Omitted names are initialized as the default value.
1588
+ * @option options :timeout
1589
+ * ロックを獲得できなかった場合は _:timeout_ 秒間ロックの獲
1590
+ * 得を試みる。 _:timeout_ 秒以内にロックを獲得できなかった
1591
+ * 場合は例外が発生する。
1592
+ * @option options :id
1593
+ * _:id_ で指定したレコードをロックする。(注: groonga側が
1594
+ * 未実装のため、現在は無視される)
1577
1595
  */
1578
1596
  static VALUE
1579
1597
  rb_grn_table_lock (int argc, VALUE *argv, VALUE self)
@@ -1615,22 +1633,16 @@ rb_grn_table_lock (int argc, VALUE *argv, VALUE self)
1615
1633
  }
1616
1634
 
1617
1635
  /*
1618
- * Document-method: clear_lock
1619
- *
1620
- * call-seq:
1621
- * table.clear_lock(options={})
1622
- *
1623
1636
  * _table_ のロックを強制的に解除する。
1624
1637
  *
1625
- * 利用可能なオプションは以下の通り。
1626
- * @param options [::Hash] The name and value
1627
- * pairs. Omitted names are initialized as the default value.
1628
- * @option options :id The id
1629
- *
1630
- * _:id_ で指定したレコードのロックを強制的に解除する。
1631
- * (注: groonga側が未実装のため、現在は無視される。実装さ
1632
- * れるのではないかと思っているが、実装されないかもしれな
1633
- * い。)
1638
+ * @overload clear_lock(options={})
1639
+ * @param [::Hash] options The name and value
1640
+ * pairs. Omitted names are initialized as the default value.
1641
+ * @option options :id
1642
+ * _:id_ で指定したレコードのロックを強制的に解除する。
1643
+ * (注: groonga側が未実装のため、現在は無視される。実装さ
1644
+ * れるのではないかと思っているが、実装されないかもしれな
1645
+ * い。)
1634
1646
  */
1635
1647
  static VALUE
1636
1648
  rb_grn_table_clear_lock (int argc, VALUE *argv, VALUE self)
@@ -1660,22 +1672,16 @@ rb_grn_table_clear_lock (int argc, VALUE *argv, VALUE self)
1660
1672
  }
1661
1673
 
1662
1674
  /*
1663
- * Document-method: locked?
1664
- *
1665
- * call-seq:
1666
- * table.locked?(options={})
1667
- *
1668
1675
  * _table_ がロックされていれば +true+ を返す。
1669
1676
  *
1670
- * 利用可能なオプションは以下の通り。
1671
- * @param options [options] The name and value
1672
- * pairs. Omitted names are initialized as the default value.
1673
- * @option options :id The id
1674
- *
1675
- * _:id_ で指定したレコードがロックされていれば +true+ を返す。
1676
- * (注: groonga側が未実装のため、現在は無視される。実装さ
1677
- * れるのではないかと思っているが、実装されないかもしれな
1678
- * い。)
1677
+ * @overload locked?(options={})
1678
+ * @param [options] options The name and value
1679
+ * pairs. Omitted names are initialized as the default value.
1680
+ * @option options :id
1681
+ * _:id_ で指定したレコードがロックされていれば +true+ を返す。
1682
+ * (注: groonga側が未実装のため、現在は無視される。実装さ
1683
+ * れるのではないかと思っているが、実装されないかもしれな
1684
+ * い。)
1679
1685
  */
1680
1686
  static VALUE
1681
1687
  rb_grn_table_is_locked (int argc, VALUE *argv, VALUE self)
@@ -1703,11 +1709,6 @@ rb_grn_table_is_locked (int argc, VALUE *argv, VALUE self)
1703
1709
  }
1704
1710
 
1705
1711
  /*
1706
- * call-seq:
1707
- * table.select(options) {|record| ...} -> Groonga::Hash
1708
- * table.select(query, options) -> Groonga::Hash
1709
- * table.select(expression, options) -> Groonga::Hash
1710
- *
1711
1712
  * _table_ からブロックまたは文字列で指定した条件にマッチする
1712
1713
  * レコードを返す。返されたテーブルには +expression+ という特
1713
1714
  * 異メソッドがあり、指定した条件を表している
@@ -1741,108 +1742,185 @@ rb_grn_table_is_locked (int argc, VALUE *argv, VALUE self)
1741
1742
  * ---
1742
1743
  * </pre>
1743
1744
  *
1744
- * _query_ には「[カラム名]:[演算子][値]」という書式で条件を
1745
- * 指定する。演算子は以下の通り。
1746
- *
1747
- * - なし := [カラム値] == [値]
1748
- * - @!@ := [カラム値] != [値]
1749
- * - @<@ := [カラム値] < [値]
1750
- * - @>@ := [カラム値] > [値]
1751
- * - @<=@ := [カラム値] <= [値]
1752
- * - @>=@ := [カラム値] >= [値]
1753
- * - @@@ := [カラム値]が[値]を含んでいるかどうか
1754
- *
1755
- * 例:
1756
- *
1757
- * <pre>
1758
- * !!!ruby
1759
- * "name:daijiro" # "name"カラムの値が"daijiro"のレコードにマッチ
1760
- * "description:@groonga" # "description"カラムが
1761
- * # "groonga"を含んでいるレコードにマッチ
1762
- * </pre>
1763
- *
1764
- * _expression_ には既に作成済みのGroonga::Expressionを渡す
1765
- *
1766
- * ブロックで条件を指定する場合は
1767
- * Groonga::RecordExpressionBuilderを参照。
1768
- *
1769
- * Ruby1.9以降では、ブロックで条件を指定する際に
1770
- * Groonga::ColumnExpressionBuilderの他に"!="も使用可能。
1771
- *
1772
- * 例:
1773
- *
1774
- * <pre>
1775
- * !!!ruby
1776
- * comments = Groonga::Array.create(:name => "Comments")
1777
- * comments.define_column("content", "Text")
1778
- * comments.add(:content => "Hello Good-bye!")
1779
- * comments.add(:content => "Hello World")
1780
- * comments.add(:content => "test")
1781
- * result = comments.select do |record|
1782
- * record.content != "test"
1783
- * end
1784
- * p result.collect {|record| record.content}
1785
- * # => ["Hello Good-bye!", "Hello World"]
1786
- * </pre>
1787
- *
1788
- * _options_ に指定可能な値は以下の通り。
1789
- * @param options [::Hash] The name and value
1790
- * pairs. Omitted names are initialized as the default value.
1791
- * @option options :default_column
1792
- *
1793
- * "column_name:hoge"ではなく"hoge"のようにcolumn_nameが指
1794
- * 定されない条件の検索対象となるカラムを指定する。
1795
- *
1796
- * @option options :operator (Groonga::Operator::OR) The operator
1797
- *
1798
- * マッチしたレコードをどのように扱うか。指定可能な値は以
1799
- * 下の通り。省略した場合はGroonga::Operator::OR。
1800
- *
1801
- * [Groonga::Operator::OR] マッチしたレコードを追加。すで
1802
- * にレコードが追加されている場合
1803
- * は何もしない。
1804
- * [Groonga::Operator::AND] マッチしたレコードのスコアを増
1805
- * 加。マッチしなかったレコード
1806
- * を削除。
1807
- * [Groonga::Operator::BUT] マッチしたレコードを削除。
1808
- * [Groonga::Operator::ADJUST] マッチしたレコードのスコア
1809
- * を増加。
1810
- *
1811
- * @option options :result The result
1812
- *
1813
- * 検索結果を格納するテーブル。マッチしたレコードが追加さ
1814
- * れていく。省略した場合は新しくテーブルを作成して返す。
1815
- *
1816
- * @option options :name The name
1817
- *
1818
- * 条件の名前。省略した場合は名前を付けない。
1819
- *
1820
- * @option options :syntax The syntax
1821
- *
1822
- * _query_ の構文。省略した場合は +:query+ 。
1823
- *
1824
- * 参考: Groonga::Expression#parse.
1825
- *
1826
- * @option options :allow_pragma The allow_pragma
1827
- *
1828
- * query構文時にプラグマを利用するかどうか。省略した場合は
1829
- * 利用する。
1830
- *
1831
- * 参考: Groonga::Expression#parse.
1832
- *
1833
- * @option options :allow_column The allow_column
1834
- *
1835
- * query構文時にカラム指定を利用するかどうか。省略した場合
1836
- * は利用する。
1837
- *
1838
- * 参考: Groonga::Expression#parse.
1839
- *
1840
- * @option options :allow_update The allow_update
1841
- *
1842
- * script構文時に更新操作を利用するかどうか。省略した場合
1843
- * は利用する。
1844
- *
1845
- * 参考: Groonga::Expression#parse.
1745
+ * @overload select(options)
1746
+ * @yield [record] ブロックで条件を指定する場合は
1747
+ * Groonga::RecordExpressionBuilderを参照。
1748
+ *
1749
+ * Ruby1.9以降では、ブロックで条件を指定する際に
1750
+ * Groonga::ColumnExpressionBuilderの他に"!="も使用可能。
1751
+ *
1752
+ * 例:
1753
+ *
1754
+ * <pre>
1755
+ * !!!ruby
1756
+ * comments = Groonga::Array.create(:name => "Comments")
1757
+ * comments.define_column("content", "Text")
1758
+ * comments.add(:content => "Hello Good-bye!")
1759
+ * comments.add(:content => "Hello World")
1760
+ * comments.add(:content => "test")
1761
+ * result = comments.select do |record|
1762
+ * record.content != "test"
1763
+ * end
1764
+ * p result.collect {|record| record.content}
1765
+ * # => ["Hello Good-bye!", "Hello World"]
1766
+ * </pre>
1767
+ *
1768
+ * @param options [::Hash] The name and value
1769
+ * pairs. Omitted names are initialized as the default value.
1770
+ * @option options :default_column
1771
+ * "column_name:hoge"ではなく"hoge"のようにcolumn_nameが指
1772
+ * 定されない条件の検索対象となるカラムを指定する。
1773
+ * @option options :operator (Groonga::Operator::OR)
1774
+ * マッチしたレコードをどのように扱うか。指定可能な値は以
1775
+ * 下の通り。省略した場合はGroonga::Operator::OR。
1776
+ *
1777
+ * [Groonga::Operator::OR] マッチしたレコードを追加。すで
1778
+ * にレコードが追加されている場合
1779
+ * は何もしない。
1780
+ * [Groonga::Operator::AND] マッチしたレコードのスコアを増
1781
+ * 加。マッチしなかったレコード
1782
+ * を削除。
1783
+ * [Groonga::Operator::BUT] マッチしたレコードを削除。
1784
+ * [Groonga::Operator::ADJUST] マッチしたレコードのスコア
1785
+ * を増加。
1786
+ *
1787
+ * @option options :result
1788
+ * 検索結果を格納するテーブル。マッチしたレコードが追加さ
1789
+ * れていく。省略した場合は新しくテーブルを作成して返す。
1790
+ * @option options :name
1791
+ * 条件の名前。省略した場合は名前を付けない。
1792
+ * @option options :syntax
1793
+ * _query_ の構文。省略した場合は +:query+ 。
1794
+ *
1795
+ * 参考: Groonga::Expression#parse.
1796
+ * @option options :allow_pragma
1797
+ * query構文時にプラグマを利用するかどうか。省略した場合は
1798
+ * 利用する。
1799
+ *
1800
+ * 参考: Groonga::Expression#parse.
1801
+ * @option options :allow_column
1802
+ * query構文時にカラム指定を利用するかどうか。省略した場合
1803
+ * は利用する。
1804
+ *
1805
+ * 参考: Groonga::Expression#parse.
1806
+ * @option options :allow_update
1807
+ * script構文時に更新操作を利用するかどうか。省略した場合
1808
+ * は利用する。
1809
+ *
1810
+ * 参考: Groonga::Expression#parse.
1811
+ *
1812
+ * @overload select(query, options)
1813
+ * _query_ には「[カラム名]:[演算子][値]」という書式で条件を
1814
+ * 指定する。演算子は以下の通り。
1815
+ *
1816
+ * - なし := [カラム値] == [値]
1817
+ * - @!@ := [カラム値] != [値]
1818
+ * - @<@ := [カラム値] < [値]
1819
+ * - @>@ := [カラム値] > [値]
1820
+ * - @<=@ := [カラム値] <= [値]
1821
+ * - @>=@ := [カラム値] >= [値]
1822
+ * - @@@ := [カラム値]が[値]を含んでいるかどうか
1823
+ *
1824
+ * 例:
1825
+ *
1826
+ * <pre>
1827
+ * !!!ruby
1828
+ * "name:daijiro" # "name"カラムの値が"daijiro"のレコードにマッチ
1829
+ * "description:@groonga" # "description"カラムが
1830
+ * # "groonga"を含んでいるレコードにマッチ
1831
+ * </pre>
1832
+ *
1833
+ * @param options [::Hash] The name and value
1834
+ * pairs. Omitted names are initialized as the default value.
1835
+ * @option options :default_column
1836
+ * "column_name:hoge"ではなく"hoge"のようにcolumn_nameが指
1837
+ * 定されない条件の検索対象となるカラムを指定する。
1838
+ * @option options :operator (Groonga::Operator::OR)
1839
+ * マッチしたレコードをどのように扱うか。指定可能な値は以
1840
+ * 下の通り。省略した場合はGroonga::Operator::OR。
1841
+ *
1842
+ * [Groonga::Operator::OR] マッチしたレコードを追加。すで
1843
+ * にレコードが追加されている場合
1844
+ * は何もしない。
1845
+ * [Groonga::Operator::AND] マッチしたレコードのスコアを増
1846
+ * 加。マッチしなかったレコード
1847
+ * を削除。
1848
+ * [Groonga::Operator::BUT] マッチしたレコードを削除。
1849
+ * [Groonga::Operator::ADJUST] マッチしたレコードのスコア
1850
+ * を増加。
1851
+ *
1852
+ * @option options :result
1853
+ * 検索結果を格納するテーブル。マッチしたレコードが追加さ
1854
+ * れていく。省略した場合は新しくテーブルを作成して返す。
1855
+ * @option options :name
1856
+ * 条件の名前。省略した場合は名前を付けない。
1857
+ * @option options :syntax
1858
+ * _query_ の構文。省略した場合は +:query+ 。
1859
+ *
1860
+ * 参考: Groonga::Expression#parse.
1861
+ * @option options :allow_pragma
1862
+ * query構文時にプラグマを利用するかどうか。省略した場合は
1863
+ * 利用する。
1864
+ *
1865
+ * 参考: Groonga::Expression#parse.
1866
+ * @option options :allow_column
1867
+ * query構文時にカラム指定を利用するかどうか。省略した場合
1868
+ * は利用する。
1869
+ *
1870
+ * 参考: Groonga::Expression#parse.
1871
+ * @option options :allow_update
1872
+ * script構文時に更新操作を利用するかどうか。省略した場合
1873
+ * は利用する。
1874
+ *
1875
+ * 参考: Groonga::Expression#parse.
1876
+ *
1877
+ * @overload select(expression, options)
1878
+ * _expression_ には既に作成済みのGroonga::Expressionを渡す
1879
+ *
1880
+ * @param options [::Hash] The name and value
1881
+ * pairs. Omitted names are initialized as the default value.
1882
+ * @option options :default_column
1883
+ * "column_name:hoge"ではなく"hoge"のようにcolumn_nameが指
1884
+ * 定されない条件の検索対象となるカラムを指定する。
1885
+ * @option options :operator (Groonga::Operator::OR)
1886
+ * マッチしたレコードをどのように扱うか。指定可能な値は以
1887
+ * 下の通り。省略した場合はGroonga::Operator::OR。
1888
+ *
1889
+ * [Groonga::Operator::OR] マッチしたレコードを追加。すで
1890
+ * にレコードが追加されている場合
1891
+ * は何もしない。
1892
+ * [Groonga::Operator::AND] マッチしたレコードのスコアを増
1893
+ * 加。マッチしなかったレコード
1894
+ * を削除。
1895
+ * [Groonga::Operator::BUT] マッチしたレコードを削除。
1896
+ * [Groonga::Operator::ADJUST] マッチしたレコードのスコア
1897
+ * を増加。
1898
+ *
1899
+ * @option options :result
1900
+ * 検索結果を格納するテーブル。マッチしたレコードが追加さ
1901
+ * れていく。省略した場合は新しくテーブルを作成して返す。
1902
+ * @option options :name
1903
+ * 条件の名前。省略した場合は名前を付けない。
1904
+ * @option options :syntax
1905
+ * _query_ の構文。省略した場合は +:query+ 。
1906
+ *
1907
+ * 参考: Groonga::Expression#parse.
1908
+ * @option options :allow_pragma
1909
+ * query構文時にプラグマを利用するかどうか。省略した場合は
1910
+ * 利用する。
1911
+ *
1912
+ * 参考: Groonga::Expression#parse.
1913
+ * @option options :allow_column
1914
+ * query構文時にカラム指定を利用するかどうか。省略した場合
1915
+ * は利用する。
1916
+ *
1917
+ * 参考: Groonga::Expression#parse.
1918
+ * @option options :allow_update
1919
+ * script構文時に更新操作を利用するかどうか。省略した場合
1920
+ * は利用する。
1921
+ *
1922
+ * 参考: Groonga::Expression#parse.
1923
+ * @return [Groonga::Hash]
1846
1924
  */
1847
1925
  static VALUE
1848
1926
  rb_grn_table_select (int argc, VALUE *argv, VALUE self)
@@ -2065,18 +2143,16 @@ rb_grn_table_exist_p (VALUE self, VALUE id)
2065
2143
  }
2066
2144
 
2067
2145
  /*
2068
- * Document-method: defrag
2069
- *
2070
- * call-seq:
2071
- * table.defrag(options={}) -> n_segments
2072
- *
2073
2146
  * Defrags all variable size columns in the table.
2074
2147
  *
2148
+ * @overload defrag(options={})
2149
+ * @param options [::Hash] The name and value
2150
+ * pairs. Omitted names are initialized as the default value.
2151
+ * @option options [Integer] :threshold (0) the threshold to
2152
+ * determine whether a segment is defraged. Available
2153
+ * values are -4..22. -4 means all segments are defraged.
2154
+ * 22 means no segment is defraged.
2075
2155
  * @return [Integer] the number of defraged segments
2076
- * @option options [Integer] :threshold (0) the threshold to
2077
- * determine whether a segment is defraged. Available
2078
- * values are -4..22. -4 means all segments are defraged.
2079
- * 22 means no segment is defraged.
2080
2156
  * @since 1.3.0
2081
2157
  */
2082
2158
  static VALUE