rroonga 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/bin/grntest-log-analyze +123 -0
- data/bin/groonga-query-log-extract +117 -0
- data/ext/groonga/rb-grn-accessor.c +7 -5
- data/ext/groonga/rb-grn-array-cursor.c +1 -1
- data/ext/groonga/rb-grn-array.c +34 -44
- data/ext/groonga/rb-grn-column.c +74 -38
- data/ext/groonga/rb-grn-context.c +19 -15
- data/ext/groonga/rb-grn-database.c +47 -42
- data/ext/groonga/rb-grn-double-array-trie-cursor.c +40 -0
- data/ext/groonga/rb-grn-double-array-trie.c +530 -0
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +1 -1
- data/ext/groonga/rb-grn-exception.c +1 -1
- data/ext/groonga/rb-grn-expression-builder.c +1 -1
- data/ext/groonga/rb-grn-expression.c +63 -51
- data/ext/groonga/rb-grn-fix-size-column.c +7 -7
- data/ext/groonga/rb-grn-hash-cursor.c +1 -1
- data/ext/groonga/rb-grn-hash.c +42 -39
- data/ext/groonga/rb-grn-index-column.c +35 -31
- data/ext/groonga/rb-grn-index-cursor.c +1 -1
- data/ext/groonga/rb-grn-logger.c +23 -18
- data/ext/groonga/rb-grn-object.c +40 -27
- data/ext/groonga/rb-grn-operator.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie-cursor.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +122 -90
- data/ext/groonga/rb-grn-plugin.c +8 -7
- data/ext/groonga/rb-grn-posting.c +1 -1
- data/ext/groonga/rb-grn-procedure.c +1 -1
- data/ext/groonga/rb-grn-query.c +12 -12
- data/ext/groonga/rb-grn-record.c +1 -1
- data/ext/groonga/rb-grn-snippet.c +26 -19
- data/ext/groonga/rb-grn-table-cursor-key-support.c +1 -1
- data/ext/groonga/rb-grn-table-cursor.c +4 -3
- data/ext/groonga/rb-grn-table-key-support.c +23 -23
- data/ext/groonga/rb-grn-table.c +268 -153
- data/ext/groonga/rb-grn-type.c +11 -7
- data/ext/groonga/rb-grn-utils.c +4 -1
- data/ext/groonga/rb-grn-variable-size-column.c +1 -1
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn-view-accessor.c +1 -1
- data/ext/groonga/rb-grn-view-cursor.c +1 -1
- data/ext/groonga/rb-grn-view-record.c +1 -1
- data/ext/groonga/rb-grn-view.c +43 -34
- data/ext/groonga/rb-grn.h +6 -2
- data/ext/groonga/rb-groonga.c +1 -1
- data/lib/groonga.rb +4 -2
- data/lib/groonga/context.rb +16 -41
- data/lib/groonga/dumper.rb +6 -4
- data/lib/groonga/expression-builder.rb +52 -26
- data/lib/groonga/grntest-log.rb +206 -0
- data/lib/groonga/pagination.rb +21 -19
- data/lib/groonga/patricia-trie.rb +7 -10
- data/lib/groonga/posting.rb +1 -1
- data/lib/groonga/query-log.rb +348 -0
- data/lib/groonga/record.rb +47 -143
- data/lib/groonga/schema.rb +679 -406
- data/lib/groonga/view-record.rb +4 -10
- data/rroonga-build.rb +1 -1
- data/test/test-array.rb +25 -4
- data/test/test-column.rb +8 -8
- data/test/test-database.rb +2 -3
- data/test/test-double-array-trie.rb +164 -0
- data/test/test-expression-builder.rb +2 -2
- data/test/test-expression.rb +10 -9
- data/test/test-gqtp.rb +2 -2
- data/test/test-hash.rb +32 -8
- data/test/test-patricia-trie.rb +34 -10
- data/test/test-query-log.rb +258 -0
- data/test/test-record.rb +6 -5
- data/test/test-schema-create-table.rb +8 -0
- data/test/test-schema.rb +491 -234
- data/test/test-table.rb +17 -24
- metadata +123 -100
- data/ext/groonga/Makefile +0 -233
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -107,14 +107,16 @@ rb_grn_expression_initialize (int argc, VALUE *argv, VALUE self)
|
|
107
107
|
* call-seq:
|
108
108
|
* expression.define_variable(options={}) -> Groonga::Variable
|
109
109
|
*
|
110
|
-
* _expression_で使用可能な変数を作成する。
|
110
|
+
* _expression_ で使用可能な変数を作成する。
|
111
111
|
*
|
112
|
-
* _options_に指定可能な値は以下の通り。
|
112
|
+
* _options_ に指定可能な値は以下の通り。
|
113
|
+
* @param options [::Hash] The name and value
|
114
|
+
* pairs. Omitted names are initialized as the default value.
|
115
|
+
* @option options :name (false)
|
113
116
|
*
|
114
|
-
* [+:name+]
|
115
117
|
* 変数の名前。省略した場合は名前を付けない。
|
118
|
+
* @option options :domain
|
116
119
|
*
|
117
|
-
* [+:domain+]
|
118
120
|
* テーブルを指定すると、そのテーブル用のレコードとして初期化する。
|
119
121
|
*/
|
120
122
|
static VALUE
|
@@ -160,7 +162,7 @@ rb_grn_expression_define_variable (int argc, VALUE *argv, VALUE self)
|
|
160
162
|
* operation=Groonga::Operator::PUSH,
|
161
163
|
* n_arguments=1) -> self
|
162
164
|
*
|
163
|
-
* _object_を追加し、_n_arguments_個の引数を取る_operation_を追加する。
|
165
|
+
* _object_ を追加し、 _n_arguments_ 個の引数を取る _operation_ を追加する。
|
164
166
|
*/
|
165
167
|
static VALUE
|
166
168
|
rb_grn_expression_append_object (int argc, VALUE *argv, VALUE self)
|
@@ -196,7 +198,7 @@ rb_grn_expression_append_object (int argc, VALUE *argv, VALUE self)
|
|
196
198
|
* operation=Groonga::Operator::PUSH,
|
197
199
|
* n_arguments=1) -> self
|
198
200
|
*
|
199
|
-
* _constant_を追加し、_n_arguments_個の引数を取る_operation_を追加する。
|
201
|
+
* _constant_ を追加し、 _n_arguments_ 個の引数を取る _operation_ を追加する。
|
200
202
|
*/
|
201
203
|
static VALUE
|
202
204
|
rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
@@ -233,7 +235,7 @@ rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
|
233
235
|
* call-seq:
|
234
236
|
* expression.append_operation(operation, n_arguments)
|
235
237
|
*
|
236
|
-
* _n_arguments_個の引数を取る_operation_を追加する。
|
238
|
+
* _n_arguments_ 個の引数を取る _operation_ を追加する。
|
237
239
|
*/
|
238
240
|
static VALUE
|
239
241
|
rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
@@ -259,19 +261,21 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
259
261
|
* call-seq:
|
260
262
|
* expression.parse(query, options={})
|
261
263
|
*
|
262
|
-
* 文字列_query_をパースする。
|
264
|
+
* 文字列 _query_ をパースする。
|
263
265
|
*
|
264
|
-
* _options_に指定可能な値は以下の通り。
|
266
|
+
* _options_ に指定可能な値は以下の通り。
|
267
|
+
* @param options [::Hash] The name and value
|
268
|
+
* pairs. Omitted names are initialized as the default value.
|
269
|
+
* @option options :default_column The default_column
|
265
270
|
*
|
266
|
-
* [+:default_column+]
|
267
271
|
* "column_name:hoge"ではなく"hoge"のようにcolumn_nameが指
|
268
272
|
* 定されない条件の検索対象となるカラムを指定する。
|
273
|
+
* @option options :default_operator (Groonga::Operator::AND)
|
269
274
|
*
|
270
|
-
*
|
275
|
+
* The default_operator
|
271
276
|
* "+"や"OR"で繋がれず、ただ列挙された複数の条件があった時、
|
272
|
-
* _expression_全体として各レコードをヒットとみなすかの論理
|
277
|
+
* _expression_ 全体として各レコードをヒットとみなすかの論理
|
273
278
|
* 条件を指定する。省略した場合はGroonga::Operator::AND。
|
274
|
-
*
|
275
279
|
* [Groonga::Operator::OR]
|
276
280
|
* レコードはいずれかの条件にマッチすればいい。
|
277
281
|
* [Groonga::Operator::AND]
|
@@ -279,15 +283,16 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
279
283
|
* [Groonga::Operator::BUT]
|
280
284
|
* 最初の条件にレコードはマッチし、残りの条件にレコードは
|
281
285
|
* マッチしてはならない。
|
286
|
+
* @option options :default_mode (Groonga::Operator::MATCH) The default_mode
|
282
287
|
*
|
283
|
-
* [+:default_mode+]
|
284
288
|
* 検索時のモードを指定する。省略した場合は
|
285
289
|
* Groonga::Operator::MATCH。(FIXME: モードによってどう
|
286
290
|
* いう動作になるかを書く。)
|
287
291
|
*
|
288
|
-
*
|
289
|
-
*
|
290
|
-
*
|
292
|
+
* @option options :syntax (:query) The syntax
|
293
|
+
*
|
294
|
+
* _query_ の構文を指定する。指定可能な値は以下の通り。省略
|
295
|
+
* した場合は +:query+ 。
|
291
296
|
*
|
292
297
|
* [+nil+]
|
293
298
|
* +:query+と同様。
|
@@ -303,18 +308,19 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
303
308
|
*
|
304
309
|
* 参考: grn式のscript形式(link:text/expression_rdoc.html)
|
305
310
|
*
|
306
|
-
*
|
307
|
-
* _query_の構文にquery
|
308
|
-
*
|
309
|
-
*
|
310
|
-
*
|
311
|
+
* @option options :allow_pragma The allow_pragma
|
312
|
+
* _query_ の構文に query を用いているとき( +:syntax+
|
313
|
+
* オプション参照)、「*E-1」というようにクエリの先頭で
|
314
|
+
* pragmaを利用できるようにする。script構文を用いている
|
315
|
+
* ときはこのオプションを利用できない。
|
311
316
|
*
|
312
317
|
* デフォルトではプラグマを利用できる。
|
313
318
|
*
|
314
319
|
* 参考: grn式のquery形式(link:text/expression_rdoc.html)
|
315
320
|
*
|
316
|
-
*
|
317
|
-
*
|
321
|
+
* @option options :allow_column The allow_column
|
322
|
+
*
|
323
|
+
* _query_ の構文にqueryを用いているとき(+:syntax+オプショ
|
318
324
|
* ン参照)、「カラム名:値」というようにカラム名を指定した
|
319
325
|
* 条件式を利用できるようにする。script構文を用いていると
|
320
326
|
* きはこのオプションを利用できない。
|
@@ -323,8 +329,9 @@ rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
|
323
329
|
*
|
324
330
|
* 参考: grn式のquery形式(link:text/expression_rdoc.html)
|
325
331
|
*
|
326
|
-
*
|
327
|
-
*
|
332
|
+
* @option options :allow_update The allow_update
|
333
|
+
*
|
334
|
+
* _query_の構文にscriptを用いているとき( +:syntax+ オプショ
|
328
335
|
* ン参照)、「カラム名 = 値」というように更新操作を利用で
|
329
336
|
* きるようにする。query構文を用いているときはこのオプショ
|
330
337
|
* ンを利用できない。
|
@@ -493,8 +500,8 @@ rb_grn_expression_compile (VALUE self)
|
|
493
500
|
* expression[name] -> 変数の値
|
494
501
|
* expression[offset] -> 変数の値
|
495
502
|
*
|
496
|
-
* _expression_で使用可能な変数のうち、名前が_name_または
|
497
|
-
* _offset_番目にExpression#append_objectされた変数の値を返
|
503
|
+
* _expression_ で使用可能な変数のうち、名前が _name_ または
|
504
|
+
* _offset_ 番目にExpression#append_objectされた変数の値を返
|
498
505
|
* す。
|
499
506
|
*/
|
500
507
|
static VALUE
|
@@ -537,7 +544,7 @@ grn_rc grn_expr_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *expr);
|
|
537
544
|
* call-seq:
|
538
545
|
* _expression_.inspect -> String
|
539
546
|
*
|
540
|
-
* _expression_の中身を人に見やすい文字列で返す。
|
547
|
+
* _expression_ の中身を人に見やすい文字列で返す。
|
541
548
|
*/
|
542
549
|
static VALUE
|
543
550
|
rb_grn_expression_inspect (VALUE self)
|
@@ -571,46 +578,51 @@ rb_grn_expression_inspect (VALUE self)
|
|
571
578
|
* call-seq:
|
572
579
|
* expression.snippet(tags, options) -> Groonga::Snippet
|
573
580
|
*
|
574
|
-
* _expression_からGroonga::Snippetを生成する。_tags_
|
575
|
-
*
|
581
|
+
* _expression_ からGroonga::Snippetを生成する。 _tags_ には
|
582
|
+
* キーワードの前後に挿入するタグの配列を以下のような形式で指定
|
576
583
|
* する。
|
577
|
-
*
|
578
|
-
* [
|
584
|
+
* <pre>
|
585
|
+
* ==[
|
579
586
|
* ["キーワード前に挿入する文字列1", "キーワード後に挿入する文字列1"],
|
580
587
|
* ["キーワード前に挿入する文字列2", "キーワード後に挿入する文字列2"],
|
581
588
|
* ...,
|
582
|
-
* ]
|
583
|
-
*
|
584
|
-
* もし、1つのスニペットの中に_tags_で指定したタグより多くの
|
589
|
+
* ]==
|
590
|
+
* </pre>
|
591
|
+
* もし、1つのスニペットの中に _tags_ で指定したタグより多くの
|
585
592
|
* キーワードが含まれている場合は、以下のように、また、先頭
|
586
593
|
* のタグから順番に使われる。
|
587
|
-
*
|
588
|
-
* expression.parse("Ruby groonga 検索")
|
594
|
+
* <pre>
|
595
|
+
* ==expression.parse("Ruby groonga 検索")
|
589
596
|
* tags = [["<tag1>", "</tag1>"], ["<tag2>", "</tag2>"]]
|
590
597
|
* snippet = expression.snippet(tags)
|
591
598
|
* p snippet.execute("Rubyでgroonga使って全文検索、高速検索。")
|
592
|
-
*
|
593
|
-
*
|
599
|
+
* => ["<tag1>Ruby</tag1>で<tag2>groonga</tag2>"
|
600
|
+
* => "使って全文<tag1>検索</tag1>、高速<tag2>検索</tag2>。"]==
|
601
|
+
* </pre>
|
594
602
|
*
|
595
|
-
* _options_に指定可能な値は以下の通り。
|
603
|
+
* _options_ に指定可能な値は以下の通り。
|
604
|
+
* @param options [::Hash] The name and value
|
605
|
+
* pairs. Omitted names are initialized as the default value.
|
606
|
+
* @option options :normalize (false) The normalize
|
596
607
|
*
|
597
|
-
* [+:normalize+]
|
598
608
|
* キーワード文字列・スニペット元の文字列を正規化するかど
|
599
|
-
*
|
609
|
+
* うか。省略した場合は +false+ で正規化しない。
|
600
610
|
*
|
601
|
-
*
|
602
|
-
*
|
611
|
+
* @option options :skip_leading_spaces (false) The skip_leading_spaces
|
612
|
+
*
|
613
|
+
* 先頭の空白を無視するかどうか。省略した場合は +false+ で無
|
603
614
|
* 視しない。
|
604
615
|
*
|
605
|
-
*
|
616
|
+
* @option options :width (100) The width
|
617
|
+
*
|
606
618
|
* スニペット文字列の長さ。省略した場合は100文字。
|
619
|
+
* @option options :max_results (3) The max_results
|
607
620
|
*
|
608
|
-
* [+:max_results+]
|
609
621
|
* 生成するスニペットの最大数。省略した場合は3。
|
622
|
+
* @option options :html_escape (false) The html_escape
|
610
623
|
*
|
611
|
-
*
|
612
|
-
*
|
613
|
-
* どうか。省略した場合は+false+で、HTMLエスケープしない。
|
624
|
+
* スニペット内の +<+, +>+, +&+, +"+ をHTMLエスケープするか
|
625
|
+
* どうか。省略した場合は +false+ で、HTMLエスケープしない。
|
614
626
|
*/
|
615
627
|
static VALUE
|
616
628
|
rb_grn_expression_snippet (int argc, VALUE *argv, VALUE self)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -32,7 +32,7 @@ VALUE rb_cGrnFixSizeColumn;
|
|
32
32
|
* call-seq:
|
33
33
|
* column[id] -> 値
|
34
34
|
*
|
35
|
-
* _column_の_id_に対応する値を返す。
|
35
|
+
* _column_ の _id_ に対応する値を返す。
|
36
36
|
*/
|
37
37
|
VALUE
|
38
38
|
rb_grn_fix_size_column_array_reference (VALUE self, VALUE rb_id)
|
@@ -59,7 +59,7 @@ rb_grn_fix_size_column_array_reference (VALUE self, VALUE rb_id)
|
|
59
59
|
* call-seq:
|
60
60
|
* column[id] = value
|
61
61
|
*
|
62
|
-
* _column_の_id_に対応する値を設定する。
|
62
|
+
* _column_ の _id_ に対応する値を設定する。
|
63
63
|
*/
|
64
64
|
static VALUE
|
65
65
|
rb_grn_fix_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
|
@@ -120,8 +120,8 @@ rb_grn_fix_size_column_integer_set (int argc, VALUE *argv, VALUE self, int flags
|
|
120
120
|
* call-seq:
|
121
121
|
* column.increment!(id, delta=nil)
|
122
122
|
*
|
123
|
-
* _column_の_id_に対応する値を_delta_だけ増加する。_delta_
|
124
|
-
*
|
123
|
+
* _column_ の _id_ に対応する値を _delta_ だけ増加する。 _delta_
|
124
|
+
* が +nil+ の場合は1増加する。
|
125
125
|
*/
|
126
126
|
static VALUE
|
127
127
|
rb_grn_fix_size_column_increment (int argc, VALUE *argv, VALUE self)
|
@@ -133,8 +133,8 @@ rb_grn_fix_size_column_increment (int argc, VALUE *argv, VALUE self)
|
|
133
133
|
* call-seq:
|
134
134
|
* column.decrement!(id, delta=nil)
|
135
135
|
*
|
136
|
-
* _column_の_id_に対応する値を_delta_だけ減少する。_delta_
|
137
|
-
*
|
136
|
+
* _column_ の _id_ に対応する値を _delta_ だけ減少する。 _delta_
|
137
|
+
* が +nil+ の場合は1減少する。
|
138
138
|
*/
|
139
139
|
static VALUE
|
140
140
|
rb_grn_fix_size_column_decrement (int argc, VALUE *argv, VALUE self)
|
data/ext/groonga/rb-grn-hash.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -38,34 +38,37 @@ VALUE rb_cGrnHash;
|
|
38
38
|
* 定すると、そのブロックに生成したテーブルが渡され、ブロック
|
39
39
|
* を抜けると自動的にテーブルが破棄される。
|
40
40
|
*
|
41
|
-
* _options_に指定可能な値は以下の通り。
|
41
|
+
* _options_ に指定可能な値は以下の通り。
|
42
|
+
* @param [::Hash] options The name and value
|
43
|
+
* pairs. Omitted names are initialized as the default value
|
44
|
+
* @option options [Groonga::Context] :context (Groonga::Context.default) The context
|
42
45
|
*
|
43
|
-
* [+:context+]
|
44
46
|
* テーブルが利用するGroonga::Context。省略すると
|
45
47
|
* Groonga::Context.defaultを用いる。
|
48
|
+
* @option options [Groonga::Context#[]] :name The name
|
46
49
|
*
|
47
|
-
* [+:name+]
|
48
50
|
* テーブルの名前。名前をつけると、Groonga::Context#[]に名
|
49
51
|
* 前を指定してテーブルを取得することができる。省略すると
|
50
52
|
* 無名テーブルになり、テーブルIDでのみ取得できる。
|
51
53
|
*
|
52
|
-
* [
|
54
|
+
* @option options [Groonga::Context#[]] :path The path
|
55
|
+
*
|
53
56
|
* テーブルを保存するパス。パスを指定すると永続テーブルとな
|
54
57
|
* り、プロセス終了後もレコードは保持される。次回起動時に
|
55
58
|
* Groonga::Context#[]で保存されたレコードを利用することが
|
56
59
|
* できる。省略すると一時テーブルになり、プロセスが終了する
|
57
60
|
* とレコードは破棄される。
|
58
61
|
*
|
59
|
-
*
|
60
|
-
* +true
|
61
|
-
*
|
62
|
+
* @option options :persistent The persistent
|
63
|
+
* +true+ を指定すると永続テーブルとなる。 +path+ を省略した
|
64
|
+
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
62
65
|
* Groonga::Contextに結びついているデータベースが一時デー
|
63
66
|
* タベースの場合は例外が発生する。
|
64
67
|
*
|
65
|
-
*
|
66
|
-
* +true
|
68
|
+
* @option options :key_normalize The normalize
|
69
|
+
* +true+ を指定するとキーを正規化する。
|
67
70
|
*
|
68
|
-
*
|
71
|
+
* @option options :key_type The key_type
|
69
72
|
* キーの種類を示すオブジェクトを指定する。キーの種類には型
|
70
73
|
* 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
|
71
74
|
* テーブル(Groonga::Array、Groonga::Hash、
|
@@ -84,60 +87,57 @@ VALUE rb_cGrnHash;
|
|
84
87
|
* 省略した場合はShortText型をキーとして使用する。この場合、
|
85
88
|
* 4096バイトまで使用可能である。
|
86
89
|
*
|
87
|
-
*
|
90
|
+
* @option options :value_type The value_type
|
91
|
+
*
|
88
92
|
* 値の型を指定する。省略すると値のための領域を確保しない。
|
89
93
|
* 値を保存したい場合は必ず指定すること。
|
90
94
|
*
|
91
95
|
* 参考: Groonga::Type.new
|
92
96
|
*
|
93
|
-
* [
|
97
|
+
* @option options [Groonga::IndexColumn] :default_tokenizer The default_tokenizer
|
94
98
|
* Groonga::IndexColumnで使用するトークナイザを指定する。
|
95
99
|
* デフォルトでは何も設定されていないので、テーブルに
|
96
100
|
* Groonga::IndexColumnを定義する場合は
|
97
101
|
* <tt>"TokenBigram"</tt>などを指定する必要がある。
|
98
102
|
*
|
99
|
-
* [
|
100
|
-
* +true
|
103
|
+
* @option options [Groonga::Record#n_sub_records] :sub_records The sub_records
|
104
|
+
* +true+ を指定すると#groupでグループ化したときに、
|
101
105
|
* Groonga::Record#n_sub_recordsでグループに含まれるレコー
|
102
106
|
* ドの件数を取得できる。
|
103
107
|
*
|
104
|
-
*
|
105
|
-
*
|
106
|
-
* 無名一時テーブルを生成する。
|
108
|
+
* @example
|
109
|
+
* #無名一時テーブルを生成する。
|
107
110
|
* Groonga::Hash.create
|
108
111
|
*
|
109
|
-
*
|
112
|
+
* #無名永続テーブルを生成する。
|
110
113
|
* Groonga::Hash.create(:path => "/tmp/hash.grn")
|
111
114
|
*
|
112
|
-
*
|
113
|
-
* しない。
|
115
|
+
* #名前付き永続テーブルを生成する。ただし、ファイル名は気にしない。
|
114
116
|
* Groonga::Hash.create(:name => "Bookmarks",
|
115
117
|
* :persistent => true)
|
116
118
|
*
|
117
|
-
*
|
118
|
-
* ブルを生成する。
|
119
|
+
* #それぞれのレコードに512バイトの値を格納できる無名一時テーブルを生成する。
|
119
120
|
* Groonga::Hash.create(:value => 512)
|
120
121
|
*
|
121
|
-
*
|
122
|
+
* #キーとして文字列を使用する無名一時テーブルを生成する。
|
122
123
|
* Groonga::Hash.create(:key_type => Groonga::Type::SHORT_TEXT)
|
123
124
|
*
|
124
|
-
*
|
125
|
-
*
|
125
|
+
* #キーとして文字列を使用する無名一時テーブルを生成する。
|
126
|
+
* (キーの種類を表すオブジェクトは文字列で指定。)
|
126
127
|
* Groonga::Hash.create(:key_type => "ShortText")
|
127
128
|
*
|
128
|
-
*
|
129
|
-
*
|
129
|
+
* #キーとして<tt>Bookmarks</tt>テーブルのレコードを使用す
|
130
|
+
* る無名一時テーブルを生成する。
|
130
131
|
* bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
131
132
|
* Groonga::Hash.create(:key_type => bookmarks)
|
132
133
|
*
|
133
|
-
*
|
134
|
-
*
|
135
|
-
* (テーブルは文字列で指定。)
|
134
|
+
* #キーとして<tt>Bookmarks</tt>テーブルのレコードを使用す
|
135
|
+
* #る無名一時テーブルを生成する。(テーブルは文字列で指定。)
|
136
136
|
* Groonga::Hash.create(:name => "Bookmarks")
|
137
137
|
* Groonga::Hash.create(:key_type => "Bookmarks")
|
138
138
|
*
|
139
|
-
*
|
140
|
-
*
|
139
|
+
* #全文検索用のトークンをバイグラムで切り出す無名一時テーブ
|
140
|
+
* #ルを生成する。
|
141
141
|
* bookmarks = Groonga::Hash.create(:name => "Bookmarks")
|
142
142
|
* bookmarks.define_column("comment", "Text")
|
143
143
|
* terms = Groonga::Hash.create(:name => "Terms",
|
@@ -223,20 +223,23 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
223
223
|
* call-seq:
|
224
224
|
* hash.search(key, options=nil) -> Groonga::Hash
|
225
225
|
*
|
226
|
-
* _key_にマッチするレコードのIDがキーに入っている
|
226
|
+
* _key_ にマッチするレコードのIDがキーに入っている
|
227
227
|
* Groonga::Hashを返す。マッチするレコードがない場合は空の
|
228
228
|
* Groonga::Hashが返る。
|
229
229
|
*
|
230
|
-
* _options_
|
230
|
+
* _options_ で +:result+ を指定することにより、そのテーブルにマッ
|
231
231
|
* チしたレコードIDがキーのレコードを追加することができる。
|
232
|
-
* +:result
|
232
|
+
* +:result+ にテーブルを指定した場合は、そのテーブルが返る。
|
233
|
+
*
|
234
|
+
* _options_ に指定可能な値は以下の通り。
|
235
|
+
* @param [::Hash] options The name and value
|
236
|
+
* pairs. Omitted names are initialized as the default value
|
233
237
|
*
|
234
|
-
*
|
238
|
+
* @option options :result The result
|
235
239
|
*
|
236
|
-
* [+:result+]
|
237
240
|
* 結果を格納するテーブル。
|
238
241
|
*
|
239
|
-
* 複数のキーで検索し、結果を1つのテーブルに集める。
|
242
|
+
* @example 複数のキーで検索し、結果を1つのテーブルに集める。
|
240
243
|
* result = nil
|
241
244
|
* keys = ["morita", "gunyara-kun", "yu"]
|
242
245
|
* keys.each do |key|
|