rroonga 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +21 -2
- data/bin/grndump +3 -2
- data/ext/groonga/extconf.rb +1 -6
- data/ext/groonga/rb-grn-array.c +58 -31
- data/ext/groonga/rb-grn-column.c +220 -148
- data/ext/groonga/rb-grn-context.c +46 -32
- data/ext/groonga/rb-grn-database.c +102 -90
- data/ext/groonga/rb-grn-double-array-trie.c +205 -163
- data/ext/groonga/rb-grn-encoding-support.c +2 -3
- data/ext/groonga/rb-grn-encoding.c +13 -8
- data/ext/groonga/rb-grn-exception.c +1 -1
- data/ext/groonga/rb-grn-expression.c +110 -133
- data/ext/groonga/rb-grn-fix-size-column.c +5 -4
- data/ext/groonga/rb-grn-geo-point.c +55 -0
- data/ext/groonga/rb-grn-hash.c +120 -82
- data/ext/groonga/rb-grn-index-column.c +66 -70
- data/ext/groonga/rb-grn-index-cursor.c +3 -0
- data/ext/groonga/rb-grn-logger.c +33 -51
- data/ext/groonga/rb-grn-object.c +2 -0
- data/ext/groonga/rb-grn-operator.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +287 -232
- data/ext/groonga/rb-grn-plugin.c +11 -14
- data/ext/groonga/rb-grn-snippet.c +37 -54
- data/ext/groonga/rb-grn-table-cursor-key-support.c +3 -3
- data/ext/groonga/rb-grn-table-cursor.c +8 -6
- data/ext/groonga/rb-grn-table-key-support.c +22 -29
- data/ext/groonga/rb-grn-table.c +355 -279
- data/ext/groonga/rb-grn-type.c +18 -25
- data/ext/groonga/rb-grn-utils.c +77 -7
- data/ext/groonga/rb-grn-variable-size-column.c +12 -20
- data/ext/groonga/rb-grn-view.c +56 -51
- data/ext/groonga/rb-grn.h +28 -1
- data/ext/groonga/rb-groonga.c +1 -0
- data/lib/groonga.rb +2 -0
- data/lib/groonga/command.rb +3 -1
- data/lib/groonga/database.rb +27 -0
- data/lib/groonga/dumper.rb +96 -17
- data/lib/groonga/geo-point.rb +216 -0
- data/lib/groonga/schema.rb +29 -46
- data/rroonga-build.rb +1 -1
- data/rroonga.gemspec +90 -0
- data/test/groonga-test-utils.rb +168 -0
- data/test/run-test.rb +60 -0
- data/test/test-accessor.rb +36 -0
- data/test/test-array.rb +146 -0
- data/test/test-column.rb +350 -0
- data/test/test-command-select.rb +181 -0
- data/test/test-context.rb +130 -0
- data/test/test-database-dumper.rb +259 -0
- data/test/test-database.rb +173 -0
- data/test/test-double-array-trie.rb +189 -0
- data/test/test-encoding.rb +33 -0
- data/test/test-exception.rb +230 -0
- data/test/test-expression-builder.rb +602 -0
- data/test/test-expression.rb +134 -0
- data/test/test-fix-size-column.rb +77 -0
- data/test/test-geo-point.rb +190 -0
- data/test/test-gqtp.rb +70 -0
- data/test/test-hash.rb +367 -0
- data/test/test-index-column.rb +180 -0
- data/test/test-index-cursor.rb +123 -0
- data/test/test-logger.rb +37 -0
- data/test/test-pagination.rb +249 -0
- data/test/test-patricia-trie.rb +440 -0
- data/test/test-plugin.rb +35 -0
- data/test/test-procedure.rb +37 -0
- data/test/test-query-log.rb +258 -0
- data/test/test-record.rb +577 -0
- data/test/test-remote.rb +63 -0
- data/test/test-schema-create-table.rb +267 -0
- data/test/test-schema-dumper.rb +235 -0
- data/test/test-schema-type.rb +208 -0
- data/test/test-schema-view.rb +90 -0
- data/test/test-schema.rb +886 -0
- data/test/test-snippet.rb +130 -0
- data/test/test-table-dumper.rb +353 -0
- data/test/test-table-offset-and-limit.rb +100 -0
- data/test/test-table-select-mecab.rb +80 -0
- data/test/test-table-select-normalize.rb +57 -0
- data/test/test-table-select-weight.rb +123 -0
- data/test/test-table-select.rb +191 -0
- data/test/test-table-traverse.rb +304 -0
- data/test/test-table.rb +711 -0
- data/test/test-type.rb +79 -0
- data/test/test-variable-size-column.rb +147 -0
- data/test/test-variable.rb +28 -0
- data/test/test-vector-column.rb +76 -0
- data/test/test-version.rb +61 -0
- data/test/test-view.rb +72 -0
- metadata +330 -202
data/ext/groonga/rb-grn-plugin.c
CHANGED
@@ -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
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
80
|
-
*
|
81
|
-
*
|
82
|
-
*
|
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
|
-
*
|
59
|
-
* Groonga::Snippet.new(options={})
|
58
|
+
* スニペットを作成する。
|
60
59
|
*
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
80
|
-
*
|
81
|
-
*
|
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
|
-
*
|
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
|
-
*
|
178
|
-
*
|
179
|
-
*
|
180
|
-
*
|
181
|
-
*
|
182
|
-
*
|
183
|
-
*
|
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)
|
@@ -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)
|
data/ext/groonga/rb-grn-table.c
CHANGED
@@ -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
|
-
*
|
235
|
-
*
|
236
|
-
*
|
237
|
-
*
|
238
|
-
*
|
239
|
-
*
|
240
|
-
*
|
241
|
-
*
|
242
|
-
*
|
243
|
-
*
|
244
|
-
*
|
245
|
-
*
|
246
|
-
*
|
247
|
-
*
|
248
|
-
*
|
249
|
-
*
|
250
|
-
*
|
251
|
-
*
|
252
|
-
*
|
253
|
-
*
|
254
|
-
*
|
255
|
-
*
|
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
|
-
*
|
374
|
-
*
|
375
|
-
*
|
376
|
-
*
|
377
|
-
*
|
378
|
-
*
|
379
|
-
*
|
380
|
-
*
|
381
|
-
*
|
382
|
-
*
|
383
|
-
*
|
384
|
-
*
|
385
|
-
*
|
386
|
-
*
|
387
|
-
*
|
388
|
-
*
|
389
|
-
*
|
390
|
-
*
|
391
|
-
*
|
392
|
-
*
|
393
|
-
* @
|
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
|
-
*
|
774
|
-
*
|
775
|
-
*
|
776
|
-
*
|
777
|
-
*
|
778
|
-
*
|
779
|
-
*
|
780
|
-
*
|
781
|
-
*
|
782
|
-
*
|
783
|
-
*
|
784
|
-
*
|
785
|
-
*
|
786
|
-
*
|
787
|
-
*
|
788
|
-
*
|
789
|
-
*
|
790
|
-
*
|
791
|
-
*
|
792
|
-
*
|
793
|
-
*
|
794
|
-
*
|
795
|
-
*
|
796
|
-
*
|
797
|
-
*
|
798
|
-
*
|
799
|
-
*
|
800
|
-
*
|
801
|
-
*
|
802
|
-
*
|
803
|
-
*
|
804
|
-
*
|
805
|
-
*
|
806
|
-
*
|
807
|
-
*
|
808
|
-
*
|
809
|
-
*
|
810
|
-
*
|
811
|
-
*
|
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
|
-
*
|
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
|
-
* @
|
1026
|
-
*
|
1027
|
-
*
|
1028
|
-
*
|
1029
|
-
*
|
1030
|
-
*
|
1031
|
-
*
|
1032
|
-
*
|
1033
|
-
*
|
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
|
-
*
|
1566
|
-
*
|
1567
|
-
*
|
1568
|
-
*
|
1569
|
-
*
|
1570
|
-
*
|
1571
|
-
*
|
1572
|
-
*
|
1573
|
-
*
|
1574
|
-
*
|
1575
|
-
*
|
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
|
-
*
|
1627
|
-
*
|
1628
|
-
*
|
1629
|
-
*
|
1630
|
-
*
|
1631
|
-
*
|
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
|
-
*
|
1672
|
-
*
|
1673
|
-
*
|
1674
|
-
*
|
1675
|
-
*
|
1676
|
-
*
|
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
|
-
*
|
1745
|
-
*
|
1746
|
-
*
|
1747
|
-
*
|
1748
|
-
*
|
1749
|
-
*
|
1750
|
-
*
|
1751
|
-
*
|
1752
|
-
*
|
1753
|
-
*
|
1754
|
-
*
|
1755
|
-
*
|
1756
|
-
*
|
1757
|
-
*
|
1758
|
-
*
|
1759
|
-
*
|
1760
|
-
*
|
1761
|
-
*
|
1762
|
-
*
|
1763
|
-
*
|
1764
|
-
*
|
1765
|
-
*
|
1766
|
-
*
|
1767
|
-
*
|
1768
|
-
*
|
1769
|
-
*
|
1770
|
-
*
|
1771
|
-
*
|
1772
|
-
*
|
1773
|
-
*
|
1774
|
-
*
|
1775
|
-
*
|
1776
|
-
*
|
1777
|
-
*
|
1778
|
-
*
|
1779
|
-
*
|
1780
|
-
*
|
1781
|
-
*
|
1782
|
-
*
|
1783
|
-
*
|
1784
|
-
*
|
1785
|
-
*
|
1786
|
-
*
|
1787
|
-
*
|
1788
|
-
*
|
1789
|
-
*
|
1790
|
-
*
|
1791
|
-
*
|
1792
|
-
*
|
1793
|
-
*
|
1794
|
-
*
|
1795
|
-
*
|
1796
|
-
*
|
1797
|
-
*
|
1798
|
-
*
|
1799
|
-
*
|
1800
|
-
*
|
1801
|
-
*
|
1802
|
-
*
|
1803
|
-
*
|
1804
|
-
*
|
1805
|
-
*
|
1806
|
-
*
|
1807
|
-
*
|
1808
|
-
*
|
1809
|
-
*
|
1810
|
-
*
|
1811
|
-
* @
|
1812
|
-
*
|
1813
|
-
*
|
1814
|
-
*
|
1815
|
-
*
|
1816
|
-
*
|
1817
|
-
*
|
1818
|
-
*
|
1819
|
-
*
|
1820
|
-
*
|
1821
|
-
*
|
1822
|
-
*
|
1823
|
-
*
|
1824
|
-
*
|
1825
|
-
*
|
1826
|
-
*
|
1827
|
-
*
|
1828
|
-
*
|
1829
|
-
*
|
1830
|
-
*
|
1831
|
-
*
|
1832
|
-
*
|
1833
|
-
*
|
1834
|
-
*
|
1835
|
-
*
|
1836
|
-
*
|
1837
|
-
*
|
1838
|
-
*
|
1839
|
-
*
|
1840
|
-
*
|
1841
|
-
*
|
1842
|
-
*
|
1843
|
-
*
|
1844
|
-
*
|
1845
|
-
*
|
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
|