rroonga 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -1
- data/ext/groonga/extconf.rb +36 -4
- data/ext/groonga/rb-grn-accessor.c +8 -10
- data/ext/groonga/rb-grn-array-cursor.c +2 -2
- data/ext/groonga/rb-grn-array.c +35 -59
- data/ext/groonga/rb-grn-column.c +105 -192
- data/ext/groonga/rb-grn-context.c +60 -63
- data/ext/groonga/rb-grn-database.c +27 -37
- data/ext/groonga/rb-grn-double-array-trie-cursor.c +3 -3
- data/ext/groonga/rb-grn-double-array-trie.c +75 -126
- data/ext/groonga/rb-grn-encoding.c +27 -27
- data/ext/groonga/rb-grn-expression.c +29 -24
- data/ext/groonga/rb-grn-fix-size-column.c +7 -9
- data/ext/groonga/rb-grn-hash-cursor.c +3 -3
- data/ext/groonga/rb-grn-hash.c +57 -108
- data/ext/groonga/rb-grn-index-column.c +17 -29
- data/ext/groonga/rb-grn-logger.c +11 -14
- data/ext/groonga/rb-grn-object.c +51 -94
- data/ext/groonga/rb-grn-patricia-trie-cursor.c +2 -2
- data/ext/groonga/rb-grn-patricia-trie.c +161 -276
- data/ext/groonga/rb-grn-plugin.c +6 -10
- data/ext/groonga/rb-grn-table-cursor.c +14 -21
- data/ext/groonga/rb-grn-table-key-support.c +32 -35
- data/ext/groonga/rb-grn-table.c +149 -252
- data/ext/groonga/rb-grn-variable.c +6 -7
- data/ext/groonga/rb-grn-view-accessor.c +1 -1
- data/ext/groonga/rb-grn-view-cursor.c +2 -2
- data/ext/groonga/rb-grn-view.c +28 -45
- data/ext/groonga/rb-grn.h +1 -1
- data/ext/groonga/rb-groonga.c +6 -6
- data/lib/groonga/database.rb +1 -1
- data/lib/groonga/dumper.rb +109 -33
- data/lib/groonga/expression-builder.rb +24 -0
- data/lib/groonga/pagination.rb +30 -24
- data/lib/groonga/record.rb +21 -18
- data/lib/groonga/schema.rb +156 -140
- data/test/test-command-select.rb +66 -1
- data/test/test-database-dumper.rb +50 -10
- data/test/test-expression-builder.rb +41 -0
- metadata +4 -4
@@ -26,47 +26,47 @@
|
|
26
26
|
*
|
27
27
|
* エンコーディングの指定方法は以下の通り。
|
28
28
|
*
|
29
|
-
*
|
30
|
-
*
|
29
|
+
* - +nil+ :=
|
30
|
+
* コンテキストと関連付けられているオブジェクトの場合(多
|
31
31
|
* くの場合)はコンテキストのエンコーディングを使用。
|
32
32
|
*
|
33
33
|
* それ以外のオブジェクトの場合(コンテキスト自身など)は
|
34
34
|
* groongaのビルド時に指定したエンコーディング
|
35
|
-
* (Groonga::Encoding::DEFAULT)を使用
|
35
|
+
* ( {Groonga::Encoding::DEFAULT} )を使用 =:
|
36
36
|
*
|
37
|
-
*
|
38
|
-
*
|
39
|
-
* Groonga::Encoding::DEFAULT
|
37
|
+
* - +:default+ :=
|
38
|
+
* groongaのビルド時に指定したエンコーディングを使用。
|
39
|
+
* {Groonga::Encoding::DEFAULT} =:
|
40
40
|
*
|
41
|
-
*
|
42
|
-
*
|
41
|
+
* - +:none+ :=
|
42
|
+
* エンコーディングを指定しない。{Groonga::Encoding::NONE} =:
|
43
43
|
*
|
44
|
-
*
|
45
|
-
*
|
44
|
+
* - +:euc_jp+ :=
|
45
|
+
* EUC-JPを使用。{Groonga::Encoding::EUC_JP} =:
|
46
46
|
*
|
47
|
-
*
|
48
|
-
*
|
47
|
+
* - @"euc-jp"@ :=
|
48
|
+
* +:euc_jp+と同じ。 =:
|
49
49
|
*
|
50
|
-
*
|
51
|
-
*
|
50
|
+
* - +:utf8+ :=
|
51
|
+
* UTF-8を使用。{Groonga::Encoding::UTF8} =:
|
52
52
|
*
|
53
|
-
*
|
54
|
-
*
|
53
|
+
* - @"utf-8"@ :=
|
54
|
+
* +:utf8+と同じ。 =:
|
55
55
|
*
|
56
|
-
*
|
57
|
-
*
|
56
|
+
* - +:sjis+ :=
|
57
|
+
* Shift_JISを使用。{Groonga::Encoding::SJIS} =:
|
58
58
|
*
|
59
|
-
*
|
60
|
-
*
|
59
|
+
* - +:shift_jis+ :=
|
60
|
+
* +:sjis+と同じ。 =:
|
61
61
|
*
|
62
|
-
*
|
63
|
-
*
|
62
|
+
* - @"shift-jis"@ :=
|
63
|
+
* +:sjis+と同じ。 =:
|
64
64
|
*
|
65
|
-
*
|
66
|
-
*
|
65
|
+
* - +:latin1+ :=
|
66
|
+
* Latin-1を使用。{Groonga::Encoding::LATIN1} =:
|
67
67
|
*
|
68
|
-
*
|
69
|
-
*
|
68
|
+
* - +:koi8r+ :=
|
69
|
+
* KOI8-Rを使用。{Groonga::Encoding::KOI8R} =:
|
70
70
|
*/
|
71
71
|
|
72
72
|
static VALUE mGrnEncoding;
|
@@ -207,7 +207,7 @@ rb_grn_encoding_s_get_default (VALUE self)
|
|
207
207
|
* デフォルトのエンコーディングを設定する。
|
208
208
|
* @overload default=(encoding)
|
209
209
|
* @param [Groonga::Encoding] encoding 指定するエンコーディング。
|
210
|
-
* エンコーディングの指定方法はGroonga::Encodingを参照。
|
210
|
+
* エンコーディングの指定方法は {Groonga::Encoding} を参照。
|
211
211
|
*/
|
212
212
|
static VALUE
|
213
213
|
rb_grn_encoding_s_set_default (VALUE self, VALUE rb_encoding)
|
@@ -235,10 +235,9 @@ rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
|
235
235
|
}
|
236
236
|
|
237
237
|
/*
|
238
|
-
* call-seq:
|
239
|
-
* expression.append_operation(operation, n_arguments)
|
240
|
-
*
|
241
238
|
* _n_arguments_ 個の引数を取る _operation_ を追加する。
|
239
|
+
*
|
240
|
+
* @overload append_operation(operation, n_arguments)
|
242
241
|
*/
|
243
242
|
static VALUE
|
244
243
|
rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
@@ -293,12 +292,12 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
293
292
|
* 「文字列1 OR 文字列2」で「"文字列1"あるいは"文字列2"
|
294
293
|
* にマッチという検索エンジンで利用できるような構文を使
|
295
294
|
* う。
|
296
|
-
* 参考:
|
295
|
+
* 参考: "Groongaのクエリ構文のドキュメント":http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html =:
|
297
296
|
* - +nil+ :=
|
298
297
|
* +:query+と同様 =:
|
299
298
|
* - +:script+ :=
|
300
299
|
* 「[カラム名] == [値]」というようにECMAScript風の構文を使う。
|
301
|
-
* 参考:
|
300
|
+
* 参考: "Groongaのscript構文のドキュメント":http://groonga.org/ja/docs/reference/grn_expr/script_syntax.html =:
|
302
301
|
* @option options :allow_pragma
|
303
302
|
* _query_ の構文に query を用いているとき( +:syntax+
|
304
303
|
* オプション参照)、「*E-1」というようにクエリの先頭で
|
@@ -307,7 +306,7 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
307
306
|
*
|
308
307
|
* デフォルトではプラグマを利用できる。
|
309
308
|
*
|
310
|
-
* 参考:
|
309
|
+
* 参考: "Groongaのクエリ構文のドキュメント":http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html
|
311
310
|
* @option options :allow_column
|
312
311
|
* _query_ の構文にqueryを用いているとき( +:syntax+ オプショ
|
313
312
|
* ン参照)、「カラム名:値」というようにカラム名を指定した
|
@@ -316,7 +315,7 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
316
315
|
*
|
317
316
|
* デフォルトではカラム名を指定した条件式を利用できる。
|
318
317
|
*
|
319
|
-
* 参考:
|
318
|
+
* 参考: "Groongaのクエリ構文のドキュメント":http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html
|
320
319
|
* @option options :allow_update
|
321
320
|
* _query_ の構文にscriptを用いているとき( +:syntax+ オプショ
|
322
321
|
* ン参照)、「カラム名 = 値」というように更新操作を利用で
|
@@ -325,7 +324,7 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
325
324
|
*
|
326
325
|
* デフォルトでは更新操作を利用できる。
|
327
326
|
*
|
328
|
-
* 参考:
|
327
|
+
* 参考: "Groongaのクエリ構文のドキュメント":http://groonga.org/ja/docs/reference/grn_expr/query_syntax.html
|
329
328
|
*/
|
330
329
|
static VALUE
|
331
330
|
rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
@@ -341,7 +340,7 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
341
340
|
grn_expr_flags flags = 0;
|
342
341
|
VALUE options, rb_query, rb_default_column, rb_default_operator;
|
343
342
|
VALUE rb_default_mode, rb_syntax;
|
344
|
-
VALUE rb_allow_pragma, rb_allow_column, rb_allow_update;
|
343
|
+
VALUE rb_allow_pragma, rb_allow_column, rb_allow_update, rb_allow_leading_not;
|
345
344
|
VALUE exception = Qnil;
|
346
345
|
|
347
346
|
rb_scan_args(argc, argv, "11", &rb_query, &options);
|
@@ -353,6 +352,7 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
353
352
|
"allow_pragma", &rb_allow_pragma,
|
354
353
|
"allow_column", &rb_allow_column,
|
355
354
|
"allow_update", &rb_allow_update,
|
355
|
+
"allow_leading_not", &rb_allow_leading_not,
|
356
356
|
NULL);
|
357
357
|
|
358
358
|
query = StringValuePtr(rb_query);
|
@@ -417,6 +417,11 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
417
417
|
flags |= GRN_EXPR_ALLOW_UPDATE;
|
418
418
|
}
|
419
419
|
|
420
|
+
if (!NIL_P(rb_allow_leading_not)) {
|
421
|
+
if (RVAL2CBOOL(rb_allow_leading_not))
|
422
|
+
flags |= GRN_EXPR_ALLOW_LEADING_NOT;
|
423
|
+
}
|
424
|
+
|
420
425
|
rc = grn_expr_parse(context, expression, query, query_size,
|
421
426
|
default_column, default_mode, default_operator,
|
422
427
|
flags);
|
@@ -436,10 +441,10 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
436
441
|
}
|
437
442
|
|
438
443
|
/*
|
439
|
-
*
|
440
|
-
* expression.execute -> 値
|
444
|
+
* _expression_ を実行し、実行した結果を返す。
|
441
445
|
*
|
442
|
-
*
|
446
|
+
* @overload execute
|
447
|
+
* @return [値]
|
443
448
|
*/
|
444
449
|
static VALUE
|
445
450
|
rb_grn_expression_execute (VALUE self)
|
@@ -459,10 +464,9 @@ rb_grn_expression_execute (VALUE self)
|
|
459
464
|
}
|
460
465
|
|
461
466
|
/*
|
462
|
-
*
|
463
|
-
* expression.compile
|
467
|
+
* _expression_ をコンパイルする。
|
464
468
|
*
|
465
|
-
*
|
469
|
+
* @overload compile
|
466
470
|
*/
|
467
471
|
static VALUE
|
468
472
|
rb_grn_expression_compile (VALUE self)
|
@@ -483,13 +487,14 @@ rb_grn_expression_compile (VALUE self)
|
|
483
487
|
}
|
484
488
|
|
485
489
|
/*
|
486
|
-
*
|
487
|
-
*
|
488
|
-
*
|
490
|
+
* _expression_ で使用可能な変数のうち、名前が _name_
|
491
|
+
* または _offset_ 番目に {Expression#append_object}
|
492
|
+
* された変数の値を返す。
|
489
493
|
*
|
490
|
-
*
|
491
|
-
*
|
492
|
-
*
|
494
|
+
* @overload [](name)
|
495
|
+
* @return [変数の値]
|
496
|
+
* @overload [](offset)
|
497
|
+
* @return [変数の値]
|
493
498
|
*/
|
494
499
|
static VALUE
|
495
500
|
rb_grn_expression_array_reference (VALUE self, VALUE rb_name_or_offset)
|
@@ -528,10 +533,10 @@ rb_grn_expression_array_reference (VALUE self, VALUE rb_name_or_offset)
|
|
528
533
|
grn_rc grn_expr_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *expr);
|
529
534
|
|
530
535
|
/*
|
531
|
-
* call-seq:
|
532
|
-
* _expression_.inspect -> String
|
533
|
-
*
|
534
536
|
* _expression_ の中身を人に見やすい文字列で返す。
|
537
|
+
*
|
538
|
+
* @overload inspect
|
539
|
+
* @return [String]
|
535
540
|
*/
|
536
541
|
static VALUE
|
537
542
|
rb_grn_expression_inspect (VALUE self)
|
@@ -29,10 +29,10 @@ VALUE rb_cGrnFixSizeColumn;
|
|
29
29
|
*/
|
30
30
|
|
31
31
|
/*
|
32
|
-
* call-seq:
|
33
|
-
* column[id] -> 値
|
34
|
-
*
|
35
32
|
* _column_ の _id_ に対応する値を返す。
|
33
|
+
*
|
34
|
+
* @overload column[id]
|
35
|
+
* @return [値]
|
36
36
|
*/
|
37
37
|
VALUE
|
38
38
|
rb_grn_fix_size_column_array_reference (VALUE self, VALUE rb_id)
|
@@ -118,11 +118,10 @@ rb_grn_fix_size_column_integer_set (int argc, VALUE *argv, VALUE self, int flags
|
|
118
118
|
}
|
119
119
|
|
120
120
|
/*
|
121
|
-
* call-seq:
|
122
|
-
* column.increment!(id, delta=nil)
|
123
|
-
*
|
124
121
|
* _column_ の _id_ に対応する値を _delta_ だけ増加する。 _delta_
|
125
122
|
* が +nil+ の場合は1増加する。
|
123
|
+
*
|
124
|
+
* @overload increment!(id, delta=nil)
|
126
125
|
*/
|
127
126
|
static VALUE
|
128
127
|
rb_grn_fix_size_column_increment (int argc, VALUE *argv, VALUE self)
|
@@ -131,11 +130,10 @@ rb_grn_fix_size_column_increment (int argc, VALUE *argv, VALUE self)
|
|
131
130
|
}
|
132
131
|
|
133
132
|
/*
|
134
|
-
* call-seq:
|
135
|
-
* column.decrement!(id, delta=nil)
|
136
|
-
*
|
137
133
|
* _column_ の _id_ に対応する値を _delta_ だけ減少する。 _delta_
|
138
134
|
* が +nil+ の場合は1減少する。
|
135
|
+
*
|
136
|
+
* @overload decrement!(id, delta=nil)
|
139
137
|
*/
|
140
138
|
static VALUE
|
141
139
|
rb_grn_fix_size_column_decrement (int argc, VALUE *argv, VALUE self)
|
@@ -23,9 +23,9 @@ VALUE rb_cGrnHashCursor;
|
|
23
23
|
/*
|
24
24
|
* Document-class: Groonga::HashCursor < Groonga::TableCursor
|
25
25
|
*
|
26
|
-
* Groonga::Hashに登録されているレコードを順番に取り出すため
|
27
|
-
* のオブジェクト。利用できるメソッドはGroonga::TableCursor
|
28
|
-
* とGroonga::TableCursorKeySupportを参照。
|
26
|
+
* {Groonga::Hash} に登録されているレコードを順番に取り出すため
|
27
|
+
* のオブジェクト。利用できるメソッドは {Groonga::TableCursor}
|
28
|
+
* と {Groonga::TableCursorKeySupport} を参照。
|
29
29
|
*/
|
30
30
|
|
31
31
|
void
|
data/ext/groonga/rb-grn-hash.c
CHANGED
@@ -55,12 +55,12 @@ VALUE rb_cGrnHash;
|
|
55
55
|
* (キーの種類を表すオブジェクトは文字列で指定。)
|
56
56
|
* Groonga::Hash.create(:key_type => "ShortText")
|
57
57
|
*
|
58
|
-
*
|
58
|
+
* #キーとしてBookmarksテーブルのレコードを使用す
|
59
59
|
* る無名一時テーブルを生成する。
|
60
60
|
* bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
61
61
|
* Groonga::Hash.create(:key_type => bookmarks)
|
62
62
|
*
|
63
|
-
*
|
63
|
+
* #キーとしてBookmarksテーブルのレコードを使用す
|
64
64
|
* #る無名一時テーブルを生成する。(テーブルは文字列で指定。)
|
65
65
|
* Groonga::Hash.create(:name => "Bookmarks")
|
66
66
|
* Groonga::Hash.create(:key_type => "Bookmarks")
|
@@ -76,116 +76,65 @@ VALUE rb_cGrnHash;
|
|
76
76
|
*
|
77
77
|
* @overload create(options={})
|
78
78
|
* @return [Groonga::Hash]
|
79
|
-
*
|
80
|
-
*
|
81
|
-
*
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*
|
86
|
-
*
|
87
|
-
*
|
88
|
-
*
|
89
|
-
*
|
90
|
-
*
|
91
|
-
*
|
92
|
-
*
|
93
|
-
*
|
94
|
-
*
|
95
|
-
*
|
96
|
-
*
|
97
|
-
*
|
98
|
-
*
|
99
|
-
*
|
100
|
-
*
|
101
|
-
*
|
102
|
-
*
|
103
|
-
*
|
104
|
-
*
|
105
|
-
*
|
79
|
+
* @!macro hash.create.options
|
80
|
+
* @param [::Hash] options The name and value
|
81
|
+
* pairs. Omitted names are initialized as the default value
|
82
|
+
* @option options [Groonga::Context] :context (Groonga::Context.default)
|
83
|
+
* テーブルが利用する {Groonga::Context} 。省略すると
|
84
|
+
* {Groonga::Context.default} を用いる。
|
85
|
+
* @option options [Groonga::Context#[]] :name
|
86
|
+
* テーブルの名前。名前をつけると、 {Groonga::Context#[]} に名
|
87
|
+
* 前を指定してテーブルを取得することができる。省略すると
|
88
|
+
* 無名テーブルになり、テーブルIDでのみ取得できる。
|
89
|
+
* @option options [Groonga::Context#[]] :path
|
90
|
+
* テーブルを保存するパス。パスを指定すると永続テーブルとな
|
91
|
+
* り、プロセス終了後もレコードは保持される。次回起動時に
|
92
|
+
* {Groonga::Context#[]} で保存されたレコードを利用することが
|
93
|
+
* できる。省略すると一時テーブルになり、プロセスが終了する
|
94
|
+
* とレコードは破棄される。
|
95
|
+
* @option options :persistent
|
96
|
+
* +true+ を指定すると永続テーブルとなる。 +path+ を省略した
|
97
|
+
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
98
|
+
* {Groonga::Context} に結びついているデータベースが一時デー
|
99
|
+
* タベースの場合は例外が発生する。
|
100
|
+
* @option options :key_normalize
|
101
|
+
* +true+ を指定するとキーを正規化する。
|
102
|
+
* @option options :key_type
|
103
|
+
* キーの種類を示すオブジェクトを指定する。キーの種類には型
|
104
|
+
* 名("Int32"や"ShortText"など)または {Groonga::Type} または
|
105
|
+
* テーブル( {Groonga::Array} 、 {Groonga::Hash} 、
|
106
|
+
* {Groonga::PatriciaTrie} のどれか)を指定する。
|
106
107
|
*
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
110
|
-
*
|
108
|
+
* {Groonga::Type} を指定した場合は、その型が示す範囲の値をキー
|
109
|
+
* として使用する。ただし、キーの最大サイズは4096バイトで
|
110
|
+
* あるため、 {Groonga::Type::TEXT} や {Groonga::Type::LONG_TEXT}
|
111
|
+
* は使用できない。
|
111
112
|
*
|
112
|
-
*
|
113
|
-
*
|
114
|
-
*
|
115
|
-
*
|
113
|
+
* テーブルを指定した場合はレコードIDをキーとして使用する。
|
114
|
+
* 指定したテーブルの {Groonga::Record} をキーとして使用するこ
|
115
|
+
* ともでき、その場合は自動的に {Groonga::Record} からレコード
|
116
|
+
* IDを取得する。
|
116
117
|
*
|
117
|
-
*
|
118
|
-
*
|
119
|
-
*
|
120
|
-
*
|
121
|
-
*
|
118
|
+
* 省略した場合はShortText型をキーとして使用する。この場合、
|
119
|
+
* 4096バイトまで使用可能である。
|
120
|
+
* @option options :value_type
|
121
|
+
* 値の型を指定する。省略すると値のための領域を確保しない。
|
122
|
+
* 値を保存したい場合は必ず指定すること。
|
122
123
|
*
|
123
|
-
*
|
124
|
-
*
|
125
|
-
*
|
126
|
-
*
|
127
|
-
*
|
128
|
-
*
|
129
|
-
*
|
130
|
-
*
|
131
|
-
*
|
132
|
-
*
|
124
|
+
* 参考: {Groonga::Type.new}
|
125
|
+
* @option options [Groonga::IndexColumn] :default_tokenizer
|
126
|
+
* {Groonga::IndexColumn} で使用するトークナイザを指定する。
|
127
|
+
* デフォルトでは何も設定されていないので、テーブルに
|
128
|
+
* {Groonga::IndexColumn} を定義する場合は
|
129
|
+
* @"TokenBigram"@ などを指定する必要がある。
|
130
|
+
* @option options [Groonga::Record#n_sub_records] :sub_records
|
131
|
+
* +true+ を指定すると {#group} でグループ化したときに、
|
132
|
+
* {Groonga::Record#n_sub_records} でグループに含まれるレコー
|
133
|
+
* ドの件数を取得できる。
|
134
|
+
* @!macro hash.create.options
|
133
135
|
* @overload create(options={})
|
134
136
|
* @yield [table]
|
135
|
-
*
|
136
|
-
* pairs. Omitted names are initialized as the default value
|
137
|
-
* @option options [Groonga::Context] :context (Groonga::Context.default)
|
138
|
-
* テーブルが利用するGroonga::Context。省略すると
|
139
|
-
* Groonga::Context.defaultを用いる。
|
140
|
-
* @option options [Groonga::Context#[]] :name
|
141
|
-
* テーブルの名前。名前をつけると、Groonga::Context#[]に名
|
142
|
-
* 前を指定してテーブルを取得することができる。省略すると
|
143
|
-
* 無名テーブルになり、テーブルIDでのみ取得できる。
|
144
|
-
* @option options [Groonga::Context#[]] :path
|
145
|
-
* テーブルを保存するパス。パスを指定すると永続テーブルとな
|
146
|
-
* り、プロセス終了後もレコードは保持される。次回起動時に
|
147
|
-
* Groonga::Context#[]で保存されたレコードを利用することが
|
148
|
-
* できる。省略すると一時テーブルになり、プロセスが終了する
|
149
|
-
* とレコードは破棄される。
|
150
|
-
* @option options :persistent
|
151
|
-
* +true+ を指定すると永続テーブルとなる。 +path+ を省略した
|
152
|
-
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
153
|
-
* Groonga::Contextに結びついているデータベースが一時デー
|
154
|
-
* タベースの場合は例外が発生する。
|
155
|
-
* @option options :key_normalize
|
156
|
-
* +true+ を指定するとキーを正規化する。
|
157
|
-
* @option options :key_type
|
158
|
-
* キーの種類を示すオブジェクトを指定する。キーの種類には型
|
159
|
-
* 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
|
160
|
-
* テーブル(Groonga::Array、Groonga::Hash、
|
161
|
-
* Groonga::PatriciaTrieのどれか)を指定する。
|
162
|
-
*
|
163
|
-
* Groonga::Typeを指定した場合は、その型が示す範囲の値をキー
|
164
|
-
* として使用する。ただし、キーの最大サイズは4096バイトで
|
165
|
-
* あるため、Groonga::Type::TEXTやGroonga::Type::LONG_TEXT
|
166
|
-
* は使用できない。
|
167
|
-
*
|
168
|
-
* テーブルを指定した場合はレコードIDをキーとして使用する。
|
169
|
-
* 指定したテーブルのGroonga::Recordをキーとして使用するこ
|
170
|
-
* ともでき、その場合は自動的にGroonga::Recordからレコード
|
171
|
-
* IDを取得する。
|
172
|
-
*
|
173
|
-
* 省略した場合はShortText型をキーとして使用する。この場合、
|
174
|
-
* 4096バイトまで使用可能である。
|
175
|
-
* @option options :value_type
|
176
|
-
* 値の型を指定する。省略すると値のための領域を確保しない。
|
177
|
-
* 値を保存したい場合は必ず指定すること。
|
178
|
-
*
|
179
|
-
* 参考: Groonga::Type.new
|
180
|
-
* @option options [Groonga::IndexColumn] :default_tokenizer
|
181
|
-
* Groonga::IndexColumnで使用するトークナイザを指定する。
|
182
|
-
* デフォルトでは何も設定されていないので、テーブルに
|
183
|
-
* Groonga::IndexColumnを定義する場合は
|
184
|
-
* <tt>"TokenBigram"</tt>などを指定する必要がある。
|
185
|
-
* @option options [Groonga::Record#n_sub_records] :sub_records
|
186
|
-
* +true+ を指定すると#groupでグループ化したときに、
|
187
|
-
* Groonga::Record#n_sub_recordsでグループに含まれるレコー
|
188
|
-
* ドの件数を取得できる。
|
137
|
+
* @!macro hash.create.options
|
189
138
|
*/
|
190
139
|
static VALUE
|
191
140
|
rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
@@ -263,8 +212,8 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
263
212
|
|
264
213
|
/*
|
265
214
|
* _key_ にマッチするレコードのIDがキーに入っている
|
266
|
-
* Groonga::Hashを返す。マッチするレコードがない場合は空の
|
267
|
-
* Groonga::Hashが返る。
|
215
|
+
* {Groonga::Hash} を返す。マッチするレコードがない場合は空の
|
216
|
+
* {Groonga::Hash} が返る。
|
268
217
|
*
|
269
218
|
* _options_ で +:result+ を指定することにより、そのテーブルにマッ
|
270
219
|
* チしたレコードIDがキーのレコードを追加することができる。
|