rroonga 2.0.4 → 2.0.5

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.
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
@@ -96,39 +96,12 @@ rb_grn_index_column_deconstruct (RbGrnIndexColumn *rb_grn_index_column,
96
96
  }
97
97
 
98
98
  /*
99
- * call-seq:
100
- * column[id] = value
101
- * column[id] = options
102
- *
103
99
  * IDが _id_ であるレコードを高速に全文検索するため転置索引を作
104
100
  * 成する。多くの場合、Groonga::Table#define_index_columnで
105
101
  * +:source+ オプションを指定することにより、自動的に全文検索
106
102
  * 用の索引は更新されるので、明示的にこのメソッドを使うこと
107
103
  * は少ない。
108
104
  *
109
- * _value_ には文字列を指定する。
110
- *
111
- * _options_ を指定することにより、より索引の作成を制御できる。
112
- * @param [::Hash] options The name and value
113
- * pairs. Omitted names are initialized as the default value
114
- * @option options :section The section
115
- *
116
- * 段落番号を指定する。省略した場合は1を指定したとみなされ
117
- * る。
118
- * Groonga::Table#define_index_columnで
119
- * <tt>{:with_section => true}</tt>を指定していなければい
120
- * けない。
121
- *
122
- * @option options :old_value The old_value
123
- *
124
- * 以前の値を指定する。省略した場合は現在の値が用いられる。
125
- * 通常は指定する必要はない。
126
- *
127
- * @option options :value The value
128
- * 新しい値を指定する。 _value_ を指定した場合と _options_ で
129
- * <tt>{:value => value}</tt>を指定した場合は同じ動作とな
130
- * る。
131
- *
132
105
  * @example 記事の段落毎に索引を作成する。
133
106
  * articles = Groonga::Array.create(:name => "<articles>")
134
107
  * articles.define_column("title", "ShortText")
@@ -163,6 +136,27 @@ rb_grn_index_column_deconstruct (RbGrnIndexColumn *rb_grn_index_column,
163
136
  * content_index.search("エンジン").collect do |record|
164
137
  * p record.key["title"] # -> "groonga"
165
138
  * end
139
+ *
140
+ * @overload []=(id, value)
141
+ * @param [String] value 新しい値
142
+ * @overload []=(id, options)
143
+ * _options_ を指定することにより、 _value_ を指定したときよりも索引の作
144
+ * 成を制御できる。
145
+ * @param [::Hash] options The name and value
146
+ * pairs. Omitted names are initialized as the default value
147
+ * @option options :section
148
+ * 段落番号を指定する。省略した場合は1を指定したとみなされ
149
+ * る。
150
+ * Groonga::Table#define_index_columnで
151
+ * <tt>{:with_section => true}</tt>を指定していなければい
152
+ * けない。
153
+ * @option options :old_value
154
+ * 以前の値を指定する。省略した場合は現在の値が用いられる。
155
+ * 通常は指定する必要はない。
156
+ * @option options :value
157
+ * 新しい値を指定する。 _value_ を指定した場合と _options_ で
158
+ * <tt>{:value => value}</tt>を指定した場合は同じ動作とな
159
+ * る。
166
160
  */
167
161
  static VALUE
168
162
  rb_grn_index_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
@@ -226,10 +220,11 @@ rb_grn_index_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
226
220
  }
227
221
 
228
222
  /*
229
- * call-seq:
230
- * column.sources -> Groonga::Columnの配列
231
- *
232
223
  * インデックス対象となっているカラムの配列を返す。
224
+ *
225
+ * @overload sources
226
+ * @return [::Array<Groonga::Column>] インデックス対象となっている
227
+ * {Groonga::Column}の配列
233
228
  */
234
229
  static VALUE
235
230
  rb_grn_index_column_get_sources (VALUE self)
@@ -240,6 +235,7 @@ rb_grn_index_column_get_sources (VALUE self)
240
235
  grn_id *source_ids;
241
236
  VALUE rb_sources;
242
237
  int i, n;
238
+ VALUE exception;
243
239
 
244
240
  rb_grn_index_column_deconstruct(SELF(self), &column, &context,
245
241
  NULL, NULL,
@@ -258,6 +254,12 @@ rb_grn_index_column_get_sources (VALUE self)
258
254
  VALUE rb_source;
259
255
 
260
256
  source = grn_ctx_at(context, *source_ids);
257
+ exception = rb_grn_context_to_exception(context, self);
258
+ if (!NIL_P(exception)) {
259
+ grn_obj_unlink(context, &sources);
260
+ rb_exc_raise(exception);
261
+ }
262
+
261
263
  rb_source = GRNOBJECT2RVAL(Qnil, context, source, GRN_FALSE);
262
264
  rb_ary_push(rb_sources, rb_source);
263
265
  source_ids++;
@@ -333,10 +335,10 @@ resolve_source_id (grn_ctx *context, grn_obj *column, grn_id range_id,
333
335
  }
334
336
 
335
337
  /*
336
- * call-seq:
337
- * column.sources = Groonga::Columnの配列
338
- *
339
338
  * インデックス対象となる複数のカラムを配列で設定する。
339
+ *
340
+ * @overload sources=(columns)
341
+ * @param [::Array<Groonga::Column>] columns インデックス対象となるカラムの配列
340
342
  */
341
343
  static VALUE
342
344
  rb_grn_index_column_set_sources (VALUE self, VALUE rb_sources)
@@ -381,10 +383,10 @@ rb_grn_index_column_set_sources (VALUE self, VALUE rb_sources)
381
383
  }
382
384
 
383
385
  /*
384
- * call-seq:
385
- * column.source = Groonga::Column
386
- *
387
386
  * インデックス対象となるカラムを設定する。
387
+ *
388
+ * @overload source=(column)
389
+ * @param [Groonga::Column] column インデックス対象とするカラム
388
390
  */
389
391
  static VALUE
390
392
  rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
@@ -396,43 +398,37 @@ rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
396
398
  }
397
399
 
398
400
  /*
399
- * Document-method: search
400
- *
401
- * call-seq:
402
- * column.search(query, options={}) -> Groonga::Hash
403
- *
404
401
  * _object_ から _query_ に対応するオブジェクトを検索し、見つかっ
405
402
  * たオブジェクトのIDがキーになっているGroonga::Hashを返す。
406
403
  *
407
- * 利用可能なオプションは以下の通り。
408
- * @param [::Hash] options The name and value
409
- * pairs. Omitted names are initialized as the default value
410
- * @option options [Groonga::Hash] :result The result
411
- * 結果を格納するGroonga::Hash。指定しない場合は新しく
412
- * Groonga::Hashを生成し、それに結果を格納して返す。
413
- * @option options :operator The operator
414
- *
415
- * 以下のどれかの値を指定する。 +nil+ , <tt>"or"</tt>, <tt>"||"</tt>,
416
- * <tt>"and"</tt>, <tt>"+"</tt>, <tt>"&&"</tt>, <tt>"but"</tt>,
417
- * <tt>"not"</tt>, <tt>"-"</tt>, <tt>"adjust"</tt>, <tt>">"</tt>。
418
- * それぞれ以下のようになる。(FIXME: 「以下」)
419
- * @option options :exact The exact
420
- *
421
- * +true+ を指定すると完全一致で検索する
422
- * @option options :longest_common_prefix The longest_common_prefix
423
- * +true+ を指定すると _query_ と同じ接頭辞をもつエントリのう
424
- * ち、もっとも長いエントリを検索する
425
- * @option options :suffix The suffix
426
- * +true+ を指定すると _query_ が後方一致するエントリを検索す
427
- *
428
- * @option options :prefix The prefix
429
- * +true+ を指定すると _query_ が前方一致するレコードを検索す
430
- *
431
- * @option options :near The near
432
- * +true+ を指定すると _query_ に指定した複数の語が近傍に含ま
433
- * れるレコードを検索する
434
- * [...]
435
- * ...
404
+ * @overload search(query, options={})
405
+ * @param [::Hash] options The name and value
406
+ * pairs. Omitted names are initialized as the default value
407
+ * @option options [Groonga::Hash] :result
408
+ * 結果を格納するGroonga::Hash。指定しない場合は新しく
409
+ * Groonga::Hashを生成し、それに結果を格納して返す。
410
+ * @option options :operator
411
+ * 以下のどれかの値を指定する。 +nil+ , <tt>"or"</tt>, <tt>"||"</tt>,
412
+ * <tt>"and"</tt>, <tt>"+"</tt>, <tt>"&&"</tt>, <tt>"but"</tt>,
413
+ * <tt>"not"</tt>, <tt>"-"</tt>, <tt>"adjust"</tt>, <tt>">"</tt>。
414
+ * それぞれ以下のようになる。(FIXME: 「以下」)
415
+ * @option options :exact
416
+ * +true+ を指定すると完全一致で検索する
417
+ * @option options :longest_common_prefix
418
+ * +true+ を指定すると _query_ と同じ接頭辞をもつエントリのう
419
+ * ち、もっとも長いエントリを検索する
420
+ * @option options :suffix
421
+ * +true+ を指定すると _query_ が後方一致するエントリを検索す
422
+ *
423
+ * @option options :prefix
424
+ * +true+ を指定すると _query_ が前方一致するレコードを検索す
425
+ *
426
+ * @option options :near
427
+ * +true+ を指定すると _query_ に指定した複数の語が近傍に含ま
428
+ * れるレコードを検索する
429
+ * [...]
430
+ * ...
431
+ * @return [Groonga::Hash]
436
432
  */
437
433
  static VALUE
438
434
  rb_grn_index_column_search (int argc, VALUE *argv, VALUE self)
@@ -1,6 +1,7 @@
1
1
  /* -*- coding: utf-8; c-file-style: "ruby" -*- */
2
2
  /*
3
3
  Copyright (C) 2011 Haruka Yoshihara <yoshihara@clear-code.com>
4
+ Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
4
5
 
5
6
  This library is free software; you can redistribute it and/or
6
7
  modify it under the terms of the GNU Lesser General Public
@@ -78,6 +79,8 @@ rb_grn_index_cursor_each (VALUE self)
78
79
  grn_obj *cursor;
79
80
  grn_ctx *context;
80
81
 
82
+ RETURN_ENUMERATOR(self, 0, NULL);
83
+
81
84
  rb_grn_index_cursor_deconstruct(SELF(self), &cursor, &context,
82
85
  NULL, NULL, NULL, NULL);
83
86
 
@@ -249,50 +249,34 @@ rb_grn_logger_initialize (int argc, VALUE *argv, VALUE self)
249
249
  }
250
250
 
251
251
  /*
252
- * call-seq:
253
- * Groonga::Logger.register(options={})
254
- {|level, time, title, message, location| ...}
255
- *
256
- * groongaがログを出力する度に呼び出されるブロックを登録す
257
- * る。
258
- *
259
- * ブロックに渡されてくる引数は _level_ , _time_ , _title_ ,
260
- * _message_ , _location_ の5つで、 _level_ はSymbol、それ以外は
261
- * 全て文字列で渡される。その4つについては _options_ で +false+
262
- * を指定することでブロックに渡さないようにすることができ、
263
- * その場合は空文字列が実際には渡される。
264
- *
265
- * _options_ に指定可能な値は以下の通り。
266
- * @param options [::Hash] The name and value
267
- * pairs. Omitted names are initialized as the default value.
268
- * @option options :level (:notice) The log level
269
- *
270
- * ログのレベルを +:none+ , +:emergency+ , +:alert+ ,
271
- * +:critical+ , +:error+ , +:warning+ , +:notice+ , +:info+ ,
272
- * +:debug+ , +:dump+ のいずれかで指定する。それより重要度が
273
- * 低いログはブロックに渡されなくなる。デフォルトでは
274
- * +:notice+ 。
275
- *
276
- * @option options :time
277
- *
278
- * ログが出力された時間をブロックに渡したいなら +true+ を指
279
- * 定する。デフォルトでは渡す。
252
+ * groongaがログを出力する度に呼び出されるブロックを登録する。
280
253
  *
281
- * @option options :title The title
282
- *
283
- * ログのタイトルをブロックに渡したいなら +true+ を指定す
284
- * る。デフォルトでは渡す。(FIXME: groongaで実装されてい
285
- * ない?)
286
- *
287
- * @option options :message The message
288
- * ログのメッセージをブロックに渡したいなら +true+ を指定す
289
- * る。デフォルトでは渡す。
290
- *
291
- * @option options :location The location
292
- *
293
- * ログの発生元のプロセスIDとgroongaのソースコードのファイ
294
- * ル名、行番号、関数名をブロックに渡したいなら +true+ を指
295
- * 定する。デフォルトでは渡す。
254
+ * @overload register(options={})
255
+ * @yield [level, time, title, message, location]
256
+ * _level_ はSymbol、それ以外は全て文字列で渡される。 _level_ 以外
257
+ * の4つについては _options_ で +false+ を指定することでブロックに
258
+ * 渡さないようにすることができ、その場合は空文字列が実際には渡される。
259
+ * @param options [::Hash] The name and value
260
+ * pairs. Omitted names are initialized as the default value.
261
+ * @option options :level (:notice)
262
+ * ログのレベルを +:none+ , +:emergency+ , +:alert+ ,
263
+ * +:critical+ , +:error+ , +:warning+ , +:notice+ , +:info+ ,
264
+ * +:debug+ , +:dump+ のいずれかで指定する。それより重要度が
265
+ * 低いログはブロックに渡されなくなる。デフォルトでは +:notice+ 。
266
+ * @option options :time
267
+ * ログが出力された時間をブロックに渡したいなら +true+ を指
268
+ * 定する。デフォルトでは渡す。
269
+ * @option options :title
270
+ * ログのタイトルをブロックに渡したいなら +true+ を指定す
271
+ * る。デフォルトでは渡す。
272
+ * (FIXME: groongaで実装されていない?)
273
+ * @option options :message
274
+ * ログのメッセージをブロックに渡したいなら +true+ を指定す
275
+ * る。デフォルトでは渡す。
276
+ * @option options :location
277
+ * ログの発生元のプロセスIDとgroongaのソースコードのファイ
278
+ * ル名、行番号、関数名をブロックに渡したいなら +true+ を指
279
+ * 定する。デフォルトでは渡す。
296
280
  */
297
281
  static VALUE
298
282
  rb_grn_logger_s_register (int argc, VALUE *argv, VALUE klass)
@@ -396,11 +380,10 @@ rb_grn_logger_s_set_path (VALUE klass, VALUE rb_path,
396
380
  #endif
397
381
 
398
382
  /*
399
- * call-seq:
400
- * Groonga::Logger.log_path # => path
383
+ * groongaのデフォルトロガーがログを出力するファイルのパスを返す。
401
384
  *
402
- * groongaのデフォルトロガーがログを出力するファイルの
403
- * パスを返す。
385
+ * @overload log_path
386
+ * @return [String] path ログを出力するファイルのパス
404
387
  */
405
388
  static VALUE
406
389
  rb_grn_logger_s_get_log_path (VALUE klass)
@@ -439,11 +422,10 @@ rb_grn_logger_s_set_log_path (VALUE klass, VALUE path)
439
422
  }
440
423
 
441
424
  /*
442
- * call-seq:
443
- * Groonga::Logger.query_log_path # => path
425
+ * groongaのデフォルトロガーがクエリログを出力するファイルのパスを返す。
444
426
  *
445
- * groongaのデフォルトロガーがクエリログを出力するファイルの
446
- * パスを返す。
427
+ * @overload query_log_path
428
+ * @return [String] path ログを出力するファイルのパス
447
429
  */
448
430
  static VALUE
449
431
  rb_grn_logger_s_get_query_log_path (VALUE klass)
@@ -49,6 +49,7 @@ rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
49
49
  grn_object = rb_grn_context_get_backward_compatibility(*context,
50
50
  name,
51
51
  name_size);
52
+ rb_grn_context_check(*context, object);
52
53
  if (!grn_object)
53
54
  rb_raise(rb_eArgError,
54
55
  "unregistered groonga object: name: <%s>",
@@ -56,6 +57,7 @@ rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
56
57
  return grn_object;
57
58
  } else if (RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cInteger))) {
58
59
  grn_object = grn_ctx_at(*context, NUM2UINT(object));
60
+ rb_grn_context_check(*context, object);
59
61
  if (!grn_object)
60
62
  rb_raise(rb_eArgError,
61
63
  "unregistered groonga object: ID: <%s>",
@@ -54,7 +54,7 @@ void
54
54
  rb_grn_init_operator (VALUE mGrn)
55
55
  {
56
56
  rb_mGrnOperator = rb_define_module_under(mGrn, "Operator");
57
- /* deprecated: backward compatibility. */
57
+ /* @deprecated backward compatibility. */
58
58
  rb_define_const(mGrn, "Operation", rb_mGrnOperator);
59
59
 
60
60
  rb_define_const(rb_mGrnOperator, "PUSH",
@@ -35,91 +35,10 @@ VALUE rb_cGrnPatriciaTrie;
35
35
  */
36
36
 
37
37
  /*
38
- * call-seq:
39
- * Groonga::PatriciaTrie.create(options={}) -> Groonga::PatriciaTrie
40
- * Groonga::PatriciaTrie.create(options={}) {|table| ... }
41
- *
42
38
  * 各レコードをパトリシアトライで管理するテーブルを生成する。
43
39
  * ブロックを指定すると、そのブロックに生成したテーブルが渡さ
44
40
  * れ、ブロックを抜けると自動的にテーブルが破棄される。
45
41
  *
46
- * _options_ に指定可能な値は以下の通り。
47
- * @param options [::Hash] The name and value
48
- * pairs. Omitted names are initialized as the default value.
49
- * @option options [Groonga::Context] :context (Groonga::Context.default)
50
- *
51
- * テーブルが利用するGroonga::Context。
52
- *
53
- * @option options :name The table name
54
- *
55
- * テーブルの名前。名前をつけると、Groonga::Context#[]に名
56
- * 前を指定してテーブルを取得することができる。省略すると
57
- * 無名テーブルになり、テーブルIDでのみ取得できる。
58
- *
59
- * @option options :path The path
60
- *
61
- * テーブルを保存するパス。パスを指定すると永続テーブルとな
62
- * り、プロセス終了後もレコードは保持される。次回起動時に
63
- * Groonga::Context#[]で保存されたレコードを利用する
64
- * ことができる。省略すると一時テーブルになり、プロセスが終
65
- * 了するとレコードは破棄される。
66
- *
67
- * @option options :persistent The persistent
68
- *
69
- * +true+ を指定すると永続テーブルとなる。 +path+ を省略した
70
- * 場合は自動的にパスが付加される。 +:context+ で指定した
71
- * Groonga::Contextに結びついているデータベースが一時デー
72
- * タベースの場合は例外が発生する。
73
- *
74
- * @option options :key_normalize The key_normalize
75
- *
76
- * +true+ を指定するとキーを正規化する。
77
- *
78
- * @option options :key_with_sis The key_with_sis
79
- *
80
- * +true+ を指定するとキーの文字列の全suffixが自動的に登
81
- * 録される。
82
- *
83
- * @option options :key_type The key_type
84
- *
85
- * キーの種類を示すオブジェクトを指定する。キーの種類には型
86
- * 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
87
- * テーブル(Groonga::Array、Groonga::Hash、
88
- * Groonga::PatriciaTrieのどれか)を指定する。
89
- *
90
- * Groonga::Typeを指定した場合は、その型が示す範囲の値をキー
91
- * として使用する。ただし、キーの最大サイズは4096バイトで
92
- * あるため、Groonga::Type::TEXTやGroonga::Type::LONG_TEXT
93
- * は使用できない。
94
- *
95
- * テーブルを指定した場合はレコードIDをキーとして使用する。
96
- * 指定したテーブルのGroonga::Recordをキーとして使用するこ
97
- * ともでき、その場合は自動的にGroonga::Recordからレコード
98
- * IDを取得する。
99
- *
100
- * 省略した場合はShortText型をキーとして使用する。この場合、
101
- * 4096バイトまで使用可能である。
102
- *
103
- * @option options :value_type The value_type
104
- *
105
- * 値の型を指定する。省略すると値のための領域を確保しない。
106
- * 値を保存したい場合は必ず指定すること。
107
- *
108
- * 参考: Groonga::Type.new
109
- *
110
- * @option options :default_tokenizer The default_tokenizer
111
- *
112
- * Groonga::IndexColumnで使用するトークナイザを指定する。
113
- * デフォルトでは何も設定されていないので、テーブルに
114
- * Groonga::IndexColumnを定義する場合は
115
- * <tt>"TokenBigram"</tt>などを指定する必要がある。
116
- *
117
- * @option options :sub_records The sub_records
118
- *
119
- * +true+ を指定すると#groupでグループ化したときに、
120
- * Groonga::Record#n_sub_recordsでグループに含まれるレコー
121
- * ドの件数を取得できる。
122
- *
123
42
  * @example
124
43
  * #無名一時テーブルを生成する。
125
44
  * Groonga::PatriciaTrie.create
@@ -162,6 +81,123 @@ VALUE rb_cGrnPatriciaTrie;
162
81
  * :default_tokenizer => "TokenBigram")
163
82
  * terms.define_index_column("content", bookmarks,
164
83
  * :source => "Bookmarks.comment")
84
+ *
85
+ * @overload create(options={})
86
+ * @return [Groonga::PatriciaTrie]
87
+ * @param options [::Hash] The name and value
88
+ * pairs. Omitted names are initialized as the default value.
89
+ * @option options [Groonga::Context] :context (Groonga::Context.default)
90
+ * テーブルが利用するGroonga::Context。
91
+ * @option options :name
92
+ * テーブルの名前。名前をつけると、Groonga::Context#[]に名
93
+ * 前を指定してテーブルを取得することができる。省略すると
94
+ * 無名テーブルになり、テーブルIDでのみ取得できる。
95
+ * @option options :path
96
+ * テーブルを保存するパス。パスを指定すると永続テーブルとな
97
+ * り、プロセス終了後もレコードは保持される。次回起動時に
98
+ * Groonga::Context#[]で保存されたレコードを利用する
99
+ * ことができる。省略すると一時テーブルになり、プロセスが終
100
+ * 了するとレコードは破棄される。
101
+ * @option options :persistent
102
+ * +true+ を指定すると永続テーブルとなる。 +path+ を省略した
103
+ * 場合は自動的にパスが付加される。 +:context+ で指定した
104
+ * Groonga::Contextに結びついているデータベースが一時デー
105
+ * タベースの場合は例外が発生する。
106
+ * @option options :key_normalize
107
+ * +true+ を指定するとキーを正規化する。
108
+ * @option options :key_with_sis
109
+ * +true+ を指定するとキーの文字列の全suffixが自動的に登
110
+ * 録される。
111
+ * @option options :key_type
112
+ * キーの種類を示すオブジェクトを指定する。キーの種類には型
113
+ * 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
114
+ * テーブル(Groonga::Array、Groonga::Hash、
115
+ * Groonga::PatriciaTrieのどれか)を指定する。
116
+ *
117
+ * Groonga::Typeを指定した場合は、その型が示す範囲の値をキー
118
+ * として使用する。ただし、キーの最大サイズは4096バイトで
119
+ * あるため、Groonga::Type::TEXTやGroonga::Type::LONG_TEXT
120
+ * は使用できない。
121
+ *
122
+ * テーブルを指定した場合はレコードIDをキーとして使用する。
123
+ * 指定したテーブルのGroonga::Recordをキーとして使用するこ
124
+ * ともでき、その場合は自動的にGroonga::Recordからレコード
125
+ * IDを取得する。
126
+ *
127
+ * 省略した場合はShortText型をキーとして使用する。この場合、
128
+ * 4096バイトまで使用可能である。
129
+ * @option options :value_type
130
+ * 値の型を指定する。省略すると値のための領域を確保しない。
131
+ * 値を保存したい場合は必ず指定すること。
132
+ *
133
+ * 参考: Groonga::Type.new
134
+ * @option options :default_tokenizer
135
+ * Groonga::IndexColumnで使用するトークナイザを指定する。
136
+ * デフォルトでは何も設定されていないので、テーブルに
137
+ * Groonga::IndexColumnを定義する場合は
138
+ * <tt>"TokenBigram"</tt>などを指定する必要がある。
139
+ * @option options :sub_records
140
+ * +true+ を指定すると#groupでグループ化したときに、
141
+ * Groonga::Record#n_sub_recordsでグループに含まれるレコー
142
+ * ドの件数を取得できる。
143
+ * @overload create(options={})
144
+ * @yield [table]
145
+ * @param options [::Hash] The name and value
146
+ * pairs. Omitted names are initialized as the default value.
147
+ * @option options [Groonga::Context] :context (Groonga::Context.default)
148
+ * テーブルが利用するGroonga::Context。
149
+ * @option options :name
150
+ * テーブルの名前。名前をつけると、Groonga::Context#[]に名
151
+ * 前を指定してテーブルを取得することができる。省略すると
152
+ * 無名テーブルになり、テーブルIDでのみ取得できる。
153
+ * @option options :path
154
+ * テーブルを保存するパス。パスを指定すると永続テーブルとな
155
+ * り、プロセス終了後もレコードは保持される。次回起動時に
156
+ * Groonga::Context#[]で保存されたレコードを利用する
157
+ * ことができる。省略すると一時テーブルになり、プロセスが終
158
+ * 了するとレコードは破棄される。
159
+ * @option options :persistent
160
+ * +true+ を指定すると永続テーブルとなる。 +path+ を省略した
161
+ * 場合は自動的にパスが付加される。 +:context+ で指定した
162
+ * Groonga::Contextに結びついているデータベースが一時デー
163
+ * タベースの場合は例外が発生する。
164
+ * @option options :key_normalize
165
+ * +true+ を指定するとキーを正規化する。
166
+ * @option options :key_with_sis
167
+ * +true+ を指定するとキーの文字列の全suffixが自動的に登
168
+ * 録される。
169
+ * @option options :key_type
170
+ * キーの種類を示すオブジェクトを指定する。キーの種類には型
171
+ * 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
172
+ * テーブル(Groonga::Array、Groonga::Hash、
173
+ * Groonga::PatriciaTrieのどれか)を指定する。
174
+ *
175
+ * Groonga::Typeを指定した場合は、その型が示す範囲の値をキー
176
+ * として使用する。ただし、キーの最大サイズは4096バイトで
177
+ * あるため、Groonga::Type::TEXTやGroonga::Type::LONG_TEXT
178
+ * は使用できない。
179
+ *
180
+ * テーブルを指定した場合はレコードIDをキーとして使用する。
181
+ * 指定したテーブルのGroonga::Recordをキーとして使用するこ
182
+ * ともでき、その場合は自動的にGroonga::Recordからレコード
183
+ * IDを取得する。
184
+ *
185
+ * 省略した場合はShortText型をキーとして使用する。この場合、
186
+ * 4096バイトまで使用可能である。
187
+ * @option options :value_type
188
+ * 値の型を指定する。省略すると値のための領域を確保しない。
189
+ * 値を保存したい場合は必ず指定すること。
190
+ *
191
+ * 参考: Groonga::Type.new
192
+ * @option options :default_tokenizer
193
+ * Groonga::IndexColumnで使用するトークナイザを指定する。
194
+ * デフォルトでは何も設定されていないので、テーブルに
195
+ * Groonga::IndexColumnを定義する場合は
196
+ * <tt>"TokenBigram"</tt>などを指定する必要がある。
197
+ * @option options :sub_records
198
+ * +true+ を指定すると#groupでグループ化したときに、
199
+ * Groonga::Record#n_sub_recordsでグループに含まれるレコー
200
+ * ドの件数を取得できる。
165
201
  */
166
202
  static VALUE
167
203
  rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
@@ -243,43 +279,14 @@ rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
243
279
  }
244
280
 
245
281
  /*
246
- * call-seq:
247
- * patricia_trie.search(key, options=nil) -> Groonga::Hash
248
- *
249
- * _key_ にマッチするレコードのIDがキーに入っている
250
- * Groonga::Hashを返す。マッチするレコードがない場合は空の
251
- * Groonga::Hashが返る。
282
+ * _key_ にマッチするレコードのIDがキーに入っているGroonga::Hashを返す。
283
+ * マッチするレコードがない場合は空のGroonga::Hashが返る。
252
284
  *
253
- * _options_ で +:result+ を指定することにより、そのテーブルにマッ
254
- * チしたレコードIDがキーのレコードを追加することができる。
285
+ * _options_ で +:result+ を指定することにより、そのテーブルにマッチした
286
+ * レコードIDがキーのレコードを追加することができる。
255
287
  * +:result+ にテーブルを指定した場合は、そのテーブルが返る。
256
288
  *
257
- * _options_ に指定可能な値は以下の通り。
258
- * @param options [::Hash] The name and value
259
- * pairs. Omitted names are initialized as the default value.
260
- * @option options :result The result
261
- *
262
- * 結果を格納するテーブル。
263
- * @option options :operator (Groonga::Operator::OR)
264
- *
265
- * マッチしたレコードをどのように扱うか。指定可能な値は以
266
- * 下の通り。
267
- *
268
- * [Groonga::Operator::OR]
269
- * マッチしたレコードを追加。すでにレコードが追加され
270
- * ている場合は何もしない。
271
- * [Groonga::Operator::AND]
272
- * マッチしたレコードのスコアを増加。マッチしなかった
273
- * レコードを削除。
274
- * [Groonga::Operator::BUT]
275
- * マッチしたレコードを削除。
276
- * [Groonga::Operator::ADJUST]
277
- * マッチしたレコードのスコアを増加。
278
- *
279
- * [+:type+]
280
- * ?????
281
- *
282
- * 複数のキーで検索し、結果を1つのテーブルに集める。
289
+ * @example 複数のキーで検索し、結果を1つのテーブルに集める。
283
290
  * result = nil
284
291
  * keys = ["morita", "gunyara-kun", "yu"]
285
292
  * keys.each do |key|
@@ -289,6 +296,30 @@ rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
289
296
  * user = record.key
290
297
  * p user.key # -> "morita"または"gunyara-kun"または"yu"
291
298
  * end
299
+ *
300
+ * @overload search(key, options=nil)
301
+ * @param options [::Hash] The name and value
302
+ * pairs. Omitted names are initialized as the default value.
303
+ * @option options :result
304
+ * 結果を格納するテーブル。
305
+ * @option options :operator (Groonga::Operator::OR)
306
+ * マッチしたレコードをどのように扱うか。指定可能な値は以
307
+ * 下の通り。
308
+ *
309
+ * [Groonga::Operator::OR]
310
+ * マッチしたレコードを追加。すでにレコードが追加され
311
+ * ている場合は何もしない。
312
+ * [Groonga::Operator::AND]
313
+ * マッチしたレコードのスコアを増加。マッチしなかった
314
+ * レコードを削除。
315
+ * [Groonga::Operator::BUT]
316
+ * マッチしたレコードを削除。
317
+ * [Groonga::Operator::ADJUST]
318
+ * マッチしたレコードのスコアを増加。
319
+ *
320
+ * [+:type+]
321
+ * ?????
322
+ * @return [Groonga::Hash]
292
323
  */
293
324
  static VALUE
294
325
  rb_grn_patricia_trie_search (int argc, VALUE *argv, VALUE self)
@@ -598,57 +629,68 @@ rb_grn_patricia_trie_open_grn_prefix_cursor (int argc, VALUE *argv, VALUE self,
598
629
 
599
630
 
600
631
  /*
601
- * call-seq:
602
- * table.open_prefix_cursor(prefix, options={}) -> Groonga::PatriciaTrieCursor
603
- * table.open_prefix_cursor(prefix, options={}) {|cursor| ... }
604
- *
605
632
  * _prefix_ に前方一致検索をするカーソルを生成して返す。ブロッ
606
633
  * クを指定すると、そのブロックに生成したカーソルが渡され、ブ
607
634
  * ロックを抜けると自動的にカーソルが破棄される。
608
635
  *
609
- * _options_ に指定可能な値は以下の通り。
610
- * @param options [::Hash] The name and value
611
- * pairs. Omitted names are initialized as the default value.
612
- * @option options :key_bytes The key_bytes
613
- *
614
- * _prefix_ のサイズ(byte)
615
- *
616
- * @option options :key_bits The key_bits
617
- *
618
- * _prefix_ のサイズ(bit)
619
- *
620
- * @option options :offset The offset
621
- *
622
- * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
623
- * からレコードを取り出す。
624
- *
625
- * @option options :limit The limit
626
- *
627
- * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
628
- * 省略された場合または-1が指定された場合は、全件が指定され
629
- * たものとみなす。
630
- *
631
- * @option options :order The order
632
- *
633
- * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
634
- * り出す。
635
- * +:desc+ または +:descending+ を指定すると降順にレコードを
636
- * 取り出す。
637
- *
638
- * @option options :order_by (:id) The order_by
639
- *
640
- * +:id+ を指定するとID順にレコードを取り出す。(デフォルト)
641
- * +:key+指定するとキー順にレコードを取り出す。
642
- *
643
- * @option options :greater_than The greater_than
644
- *
645
- * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
646
- * 範囲に含まない。
647
- *
648
- * @option options :less_than The less_than
649
- *
650
- * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
651
- * 範囲に含まない。
636
+ * @overload open_prefix_cursor(prefix, options={})
637
+ * @return [Groonga::PatriciaTrieCursor]
638
+ * @param options [::Hash] The name and value
639
+ * pairs. Omitted names are initialized as the default value.
640
+ * @option options :key_bytes
641
+ * _prefix_ のサイズ(byte)
642
+ * @option options :key_bits
643
+ * _prefix_ のサイズ(bit)
644
+ * @option options :offset
645
+ * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
646
+ * からレコードを取り出す。
647
+ * @option options :limit
648
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
649
+ * 省略された場合または-1が指定された場合は、全件が指定され
650
+ * たものとみなす。
651
+ * @option options :order
652
+ * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
653
+ * り出す。
654
+ * +:desc+ または +:descending+ を指定すると降順にレコードを
655
+ * 取り出す。
656
+ * @option options :order_by (:id)
657
+ * +:id+ を指定するとID順にレコードを取り出す。(デフォルト)
658
+ * +:key+指定するとキー順にレコードを取り出す。
659
+ * @option options :greater_than
660
+ * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
661
+ * 範囲に含まない。
662
+ * @option options :less_than
663
+ * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
664
+ * 範囲に含まない。
665
+ * @overload open_prefix_cursor(prefix, options={})
666
+ * @yield [cursor]
667
+ * @param options [::Hash] The name and value
668
+ * pairs. Omitted names are initialized as the default value.
669
+ * @option options :key_bytes
670
+ * _prefix_ のサイズ(byte)
671
+ * @option options :key_bits
672
+ * _prefix_ のサイズ(bit)
673
+ * @option options :offset
674
+ * 該当する範囲のレコードのうち、(0ベースで) _:offset_ 番目
675
+ * からレコードを取り出す。
676
+ * @option options :limit
677
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
678
+ * 省略された場合または-1が指定された場合は、全件が指定され
679
+ * たものとみなす。
680
+ * @option options :order
681
+ * +:asc+ または +:ascending+ を指定すると昇順にレコードを取
682
+ * り出す。
683
+ * +:desc+ または +:descending+ を指定すると降順にレコードを
684
+ * 取り出す。
685
+ * @option options :order_by (:id)
686
+ * +:id+ を指定するとID順にレコードを取り出す。(デフォルト)
687
+ * +:key+指定するとキー順にレコードを取り出す。
688
+ * @option options :greater_than
689
+ * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
690
+ * 範囲に含まない。
691
+ * @option options :less_than
692
+ * +true+ を指定すると _prefix_ で指定した値に一致した [ +key+ ] を
693
+ * 範囲に含まない。
652
694
  */
653
695
  static VALUE
654
696
  rb_grn_patricia_trie_open_prefix_cursor (int argc, VALUE *argv, VALUE self)
@@ -729,10 +771,6 @@ rb_grn_patricia_trie_open_grn_rk_cursor (int argc, VALUE *argv, VALUE self,
729
771
  }
730
772
 
731
773
  /*
732
- * call-seq:
733
- * table.open_rk_cursor(key, options={}) -> Groonga::PatriciaTrieCursor
734
- * table.open_rk_cursor(key, options={}) {|cursor| ... }
735
- *
736
774
  * _table_ のキーはカタカナである必要がある。また、エンコーディ
737
775
  * ングはUTF-8である必要がある。ローマ字やひらがなで _key_ を指
738
776
  * 定しても、 _key_ に対応するカタカナのキーを検索するカーソル
@@ -740,37 +778,46 @@ rb_grn_patricia_trie_open_grn_rk_cursor (int argc, VALUE *argv, VALUE self,
740
778
  * たカーソルが渡され、ブロックを抜けると自動的にカーソルが破
741
779
  * 棄される。
742
780
  *
743
- * _options_ に指定可能な値は以下の通り。
744
- * @param options [::Hash] The name and value
745
- * pairs. Omitted names are initialized as the default value.
746
- * @option options :key_bytes The key_bytes
747
- *
748
- * _key_のサイズ(byte)
749
- *
750
- * @option options :key_bits The key_bits
751
- *
752
- * _key_のサイズ(bit)(現在は未サポート)
753
- *
754
- * @option options :offset The offset
755
- *
756
- * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目
757
- * からレコードを取り出す。
758
- *
759
- * @option options :limit The limit
760
- *
761
- * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
762
- * 省略された場合または-1が指定された場合は、全件が指定され
763
- * たものとみなす。
764
- *
765
- * @option options :greater_than The greater_than
766
- *
767
- * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
768
- * 範囲に含まない。
769
- *
770
- * @option options :less_than The less_than
771
- *
772
- * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
773
- * 範囲に含まない。
781
+ * @overload open_rk_cursor(key, options={})
782
+ * @return [Groonga::PatriciaTrieCursor]
783
+ * @param options [::Hash]
784
+ * pairs. Omitted names are initialized as the default value.
785
+ * @option options :key_bytes
786
+ * _key_のサイズ(byte)
787
+ * @option options :key_bits
788
+ * _key_のサイズ(bit)(現在は未サポート)
789
+ * @option options :offset
790
+ * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目から
791
+ * レコードを取り出す。
792
+ * @option options :limit
793
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
794
+ * 省略された場合または-1が指定された場合は、全件が指定されたものとみなす。
795
+ * @option options :greater_than
796
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
797
+ * 範囲に含まない。
798
+ * @option options :less_than
799
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
800
+ * 範囲に含まない。
801
+ * @overload open_rk_cursor(key, options={})
802
+ * @yield [cursor]
803
+ * @param options [::Hash]
804
+ * pairs. Omitted names are initialized as the default value.
805
+ * @option options :key_bytes
806
+ * _key_のサイズ(byte)
807
+ * @option options :key_bits
808
+ * _key_のサイズ(bit)(現在は未サポート)
809
+ * @option options :offset
810
+ * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目から
811
+ * レコードを取り出す。
812
+ * @option options :limit
813
+ * 該当する範囲のレコードのうち、 _:limit_ 件のみを取り出す。
814
+ * 省略された場合または-1が指定された場合は、全件が指定されたものとみなす。
815
+ * @option options :greater_than
816
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
817
+ * 範囲に含まない。
818
+ * @option options :less_than
819
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
820
+ * 範囲に含まない。
774
821
  */
775
822
  static VALUE
776
823
  rb_grn_patricia_trie_open_rk_cursor (int argc, VALUE *argv, VALUE self)
@@ -820,7 +867,8 @@ rb_grn_patricia_trie_open_grn_near_cursor (int argc, VALUE *argv, VALUE self,
820
867
  NULL);
821
868
 
822
869
  key_p = RVAL2GRNBULK_WITH_TYPE(rb_key, *context, key_p,
823
- table->header.domain, grn_ctx_at(*context, table->header.domain));
870
+ table->header.domain,
871
+ grn_ctx_at(*context, table->header.domain));
824
872
  GRN_OBJ_INIT(&casted_key, GRN_BULK, 0, table->header.domain);
825
873
  if (key_p->header.domain != table->header.domain) {
826
874
  grn_obj_cast(*context, key_p, &casted_key, 0);
@@ -851,41 +899,48 @@ rb_grn_patricia_trie_open_grn_near_cursor (int argc, VALUE *argv, VALUE self,
851
899
  }
852
900
 
853
901
  /*
854
- * call-seq:
855
- * table.open_near_cursor(key, options={}) -> Groonga::PatriciaTrieCursor
856
- * table.open_near_cursor(key, options={}) {|cursor| ... }
857
- *
858
902
  * _key_ に近い順にレコードを取り出すカーソルを生成して返す。
859
- * ブロックを指定すると、そのブロックに生成したカーソルが渡さ
860
- * れ、ブロックを抜けると自動的にカーソルが破棄される。
861
- *
862
- * _options_ に指定可能な値は以下の通り。
863
- * @param options [::Hash] The name and value
864
- * pairs. Omitted names are initialized as the default value.
865
- * @option options :size The size
866
- *
867
- * _size_バイト以降のデータが同じキーのレコードに限定する。
868
- *
869
- * @option options :offset The offset
870
- *
871
- * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目
872
- * からレコードを取り出す。
873
- *
874
- * @option options :limit The limit
875
- *
876
- * 該当する範囲のレコードのうち、_:limit_件のみを取り出す。
877
- * 省略された場合または-1が指定された場合は、全件が指定され
878
- * たものとみなす。
879
- *
880
- * @option options :greater_than The greater_than
881
- *
882
- * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ]
883
- * 範囲に含まない。
884
- *
885
- * @option options :less_than
886
- *
887
- * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
888
- * 範囲に含まない。
903
+ * ブロックを指定すると、そのブロックに生成したカーソルが渡され、
904
+ * ブロックを抜けると自動的にカーソルが破棄される。
905
+ *
906
+ * @overload open_near_cursor(key, options={})
907
+ * @return [Groonga::PatriciaTrieCursor]
908
+ * @param options [::Hash] The name and value
909
+ * pairs. Omitted names are initialized as the default value.
910
+ * @option options :size
911
+ * _size_ バイト以降のデータが同じキーのレコードに限定する。
912
+ * @option options :offset
913
+ * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目
914
+ * からレコードを取り出す。
915
+ * @option options :limit
916
+ * 該当する範囲のレコードのうち、_:limit_件のみを取り出す。
917
+ * 省略された場合または-1が指定された場合は、全件が指定され
918
+ * たものとみなす。
919
+ * @option options :greater_than
920
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
921
+ * 範囲に含まない。
922
+ * @option options :less_than
923
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
924
+ * 範囲に含まない。
925
+ * @overload open_near_cursor(key, options={})
926
+ * @yield [cursor]
927
+ * @param options [::Hash] The name and value
928
+ * pairs. Omitted names are initialized as the default value.
929
+ * @option options :size
930
+ * _size_ バイト以降のデータが同じキーのレコードに限定する。
931
+ * @option options :offset
932
+ * 該当する範囲のレコードのうち、(0ベースで)_:offset_番目
933
+ * からレコードを取り出す。
934
+ * @option options :limit
935
+ * 該当する範囲のレコードのうち、_:limit_件のみを取り出す。
936
+ * 省略された場合または-1が指定された場合は、全件が指定され
937
+ * たものとみなす。
938
+ * @option options :greater_than
939
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
940
+ * 範囲に含まない。
941
+ * @option options :less_than
942
+ * +true+ を指定すると _key_ で指定した値に一致した [ +key+ ] を
943
+ * 範囲に含まない。
889
944
  */
890
945
  static VALUE
891
946
  rb_grn_patricia_trie_open_near_cursor (int argc, VALUE *argv, VALUE self)