rroonga 2.0.5 → 2.0.6
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.
- 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
data/Rakefile
CHANGED
@@ -164,7 +164,11 @@ Rake::ExtensionTask.new("groonga", spec) do |ext|
|
|
164
164
|
end
|
165
165
|
|
166
166
|
file "Makefile" => ["extconf.rb", "ext/groonga/extconf.rb"] do
|
167
|
-
|
167
|
+
extconf_args = []
|
168
|
+
if ENV["TRAVIS"]
|
169
|
+
extconf_args << "--enable-debug-build"
|
170
|
+
end
|
171
|
+
ruby("extconf.rb", *extconf_args)
|
168
172
|
end
|
169
173
|
|
170
174
|
desc "Configure"
|
data/ext/groonga/extconf.rb
CHANGED
@@ -215,13 +215,45 @@ have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
|
|
215
215
|
have_func("rb_errinfo", "ruby.h")
|
216
216
|
have_type("enum ruby_value_type", "ruby.h")
|
217
217
|
|
218
|
-
checking_for(checking_message("debug
|
219
|
-
|
220
|
-
if
|
218
|
+
checking_for(checking_message("--enable-debug-log option")) do
|
219
|
+
enable_debug_log = enable_config("debug-log", false)
|
220
|
+
if enable_debug_log
|
221
221
|
debug_flag = "-DRB_GRN_DEBUG"
|
222
222
|
$defs << debug_flag unless $defs.include?(debug_flag)
|
223
223
|
end
|
224
|
-
|
224
|
+
enable_debug_log
|
225
|
+
end
|
226
|
+
|
227
|
+
def gcc?
|
228
|
+
CONFIG["GCC"] == "yes"
|
229
|
+
end
|
230
|
+
|
231
|
+
def disable_optimization_build_flag(flags)
|
232
|
+
if gcc?
|
233
|
+
flags.gsub(/(^|\s)?-O\d(\s|$)?/, '\\1-O0\\2')
|
234
|
+
else
|
235
|
+
flags
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def enable_debug_build_flag(flags)
|
240
|
+
if gcc?
|
241
|
+
flags.gsub(/(^|\s)?-g\d?(\s|$)?/, '\\1-ggdb3\\2')
|
242
|
+
else
|
243
|
+
flags
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
checking_for(checking_message("--enable-debug-build option")) do
|
248
|
+
enable_debug_build = enable_config("debug-build", false)
|
249
|
+
if enable_debug_build
|
250
|
+
$CFLAGS = disable_optimization_build_flag($CFLAGS)
|
251
|
+
$CFLAGS = enable_debug_build_flag($CFLAGS)
|
252
|
+
|
253
|
+
CONFIG["CXXFLAGS"] = disable_optimization_build_flag(CONFIG["CXXFLAGS"])
|
254
|
+
CONFIG["CXXFLAGS"] = enable_debug_build_flag(CONFIG["CXXFLAGS"])
|
255
|
+
end
|
256
|
+
enable_debug_build
|
225
257
|
end
|
226
258
|
|
227
259
|
if ENV["INSTALL_RB"] == "yes"
|
@@ -74,17 +74,15 @@ rb_grn_accessor_finalizer (grn_ctx *context, grn_obj *grn_object,
|
|
74
74
|
}
|
75
75
|
|
76
76
|
/*
|
77
|
-
* call-seq:
|
78
|
-
* accessor.local_name
|
79
|
-
*
|
80
77
|
* アクセサ名を返す。
|
81
78
|
*
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*
|
86
|
-
*
|
87
|
-
*
|
79
|
+
* @overload local_name
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* items = Groonga::Array.create(:name => "Items")
|
83
|
+
* id = items.column("_id")
|
84
|
+
* id.name # => nil
|
85
|
+
* id.local_name # => "_id"
|
88
86
|
*/
|
89
87
|
static VALUE
|
90
88
|
rb_grn_accessor_get_local_name (VALUE self)
|
@@ -105,7 +103,7 @@ rb_grn_accessor_get_local_name (VALUE self)
|
|
105
103
|
* Document-class: Groonga::Accessor < Groonga::Object
|
106
104
|
*
|
107
105
|
* キー、値、スコアなど種々の値へのアクセスをカプセル化した
|
108
|
-
* オブジェクト。Groonga::Table#columnで取得できる。
|
106
|
+
* オブジェクト。 {Groonga::Table#column} で取得できる。
|
109
107
|
*/
|
110
108
|
void
|
111
109
|
rb_grn_init_accessor (VALUE mGrn)
|
@@ -23,8 +23,8 @@ VALUE rb_cGrnArrayCursor;
|
|
23
23
|
/*
|
24
24
|
* Document-class: Groonga::ArrayCursor < Groonga::TableCursor
|
25
25
|
*
|
26
|
-
* Groonga::Arrayに登録されているレコードを順番に取り出すため
|
27
|
-
* のオブジェクト。利用できるメソッドはGroonga::TableCursorを
|
26
|
+
* {Groonga::Array} に登録されているレコードを順番に取り出すため
|
27
|
+
* のオブジェクト。利用できるメソッドは {Groonga::TableCursor} を
|
28
28
|
* 参照。
|
29
29
|
*/
|
30
30
|
|
data/ext/groonga/rb-grn-array.c
CHANGED
@@ -50,62 +50,38 @@ VALUE rb_cGrnArray;
|
|
50
50
|
*
|
51
51
|
* @overload create(options={})
|
52
52
|
* @return [Groonga::Array]
|
53
|
-
*
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
57
|
-
*
|
58
|
-
*
|
59
|
-
*
|
60
|
-
*
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
53
|
+
* @!macro [new] array.create.options
|
54
|
+
* @param [::Hash] options The name and value
|
55
|
+
* pairs. Omitted names are initialized as the default value.
|
56
|
+
* @option options [Groonga::Context] :context (Groonga::Context.default)
|
57
|
+
* テーブルが利用する {Groonga::Context} 。
|
58
|
+
* @option options :name The name
|
59
|
+
* テーブルの名前。名前をつけると、 {Groonga::Context#[]} に名
|
60
|
+
* 前を指定してテーブルを取得することができる。省略すると
|
61
|
+
* 無名テーブルになり、テーブルIDでのみ取得できる。
|
62
|
+
* @option options :path
|
63
|
+
* テーブルを保存するパス。パスを指定すると永続テーブルとな
|
64
|
+
* り、プロセス終了後もレコードは保持される。次回起動時に
|
65
|
+
* {Groonga::Context#[]} で保存されたレコードを利用することが
|
66
|
+
* できる。省略すると一時テーブルになり、プロセスが終了する
|
67
|
+
* とレコードは破棄される。
|
68
|
+
* @option options :persistent
|
69
|
+
* +true+ を指定すると永続テーブルとなる。 +path+ を省略した
|
70
|
+
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
71
|
+
* {Groonga::Context} に結びついているデータベースが一時デー
|
72
|
+
* タベースの場合は例外が発生する。
|
73
|
+
* @option options :value_type (nil)
|
74
|
+
* 値の型を指定する。省略すると値のための領域を確保しない。
|
75
|
+
* 値を保存したい場合は必ず指定すること。
|
76
|
+
* 参考: {Groonga::Type.new}
|
77
|
+
* @option options [Groonga::Record#n_sub_records] :sub_records
|
78
|
+
* +true+ を指定すると {#group} でグループ化したときに、
|
79
|
+
* {Groonga::Record#n_sub_records} でグループに含まれるレコー
|
80
|
+
* ドの件数を取得できる。
|
81
|
+
* @!macro array.create.options
|
80
82
|
* @overload create(options={})
|
81
83
|
* @yield [table] 生成されたテーブル。ブロックを抜けると破棄される。
|
82
|
-
*
|
83
|
-
* pairs. Omitted names are initialized as the default value.
|
84
|
-
* @option options [Groonga::Context] :context (Groonga::Context.default)
|
85
|
-
* テーブルが利用するGroonga::Context
|
86
|
-
* @option options :name
|
87
|
-
* テーブルの名前。名前をつけると、Groonga::Context#[]に名
|
88
|
-
* 前を指定してテーブルを取得することができる。省略すると
|
89
|
-
* 無名テーブルになり、テーブルIDでのみ取得できる。
|
90
|
-
* @option options :path
|
91
|
-
* テーブルを保存するパス。パスを指定すると永続テーブルとな
|
92
|
-
* り、プロセス終了後もレコードは保持される。次回起動時に
|
93
|
-
* Groonga::Context#[]で保存されたレコードを利用することが
|
94
|
-
* できる。省略すると一時テーブルになり、プロセスが終了する
|
95
|
-
* とレコードは破棄される。
|
96
|
-
* @option options :persistent
|
97
|
-
* +true+ を指定すると永続テーブルとなる。 +path+ を省略した
|
98
|
-
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
99
|
-
* Groonga::Contextに結びついているデータベースが一時デー
|
100
|
-
* タベースの場合は例外が発生する。
|
101
|
-
* @option options :value_type (nil)
|
102
|
-
* 値の型を指定する。省略すると値のための領域を確保しない。
|
103
|
-
* 値を保存したい場合は必ず指定すること。
|
104
|
-
* 参考: Groonga::Type.new
|
105
|
-
* @option options [Groonga::Record#n_sub_records] :sub_records
|
106
|
-
* +true+ を指定すると#groupでグループ化したときに、
|
107
|
-
* Groonga::Record#n_sub_recordsでグループに含まれるレコー
|
108
|
-
* ドの件数を取得できる。
|
84
|
+
* @!macro array.create.options
|
109
85
|
*/
|
110
86
|
static VALUE
|
111
87
|
rb_grn_array_s_create (int argc, VALUE *argv, VALUE klass)
|
@@ -167,16 +143,13 @@ rb_grn_array_s_create (int argc, VALUE *argv, VALUE klass)
|
|
167
143
|
}
|
168
144
|
|
169
145
|
/*
|
170
|
-
* call-seq:
|
171
|
-
* array.add(values=nil) -> Groonga::Recordまたはnil
|
172
|
-
*
|
173
146
|
* レコード追加し、追加したレコードを返す。レコードの追加に失
|
174
147
|
* 敗した場合は +nil+ を返す。
|
175
148
|
*
|
176
149
|
* _values_ にはレコードのカラムに設定する値を指定する。省略
|
177
150
|
* した場合または +nil+ を指定した場合はカラムは設定しない。カ
|
178
|
-
*
|
179
|
-
* ...}
|
151
|
+
* ラムの値は @{:カラム名1 => 値1, :カラム名2 => 値2,
|
152
|
+
* ...}@ と指定する。
|
180
153
|
*
|
181
154
|
* @example
|
182
155
|
* #以下のようなユーザを格納するGroonga::Arrayが
|
@@ -193,6 +166,9 @@ rb_grn_array_s_create (int argc, VALUE *argv, VALUE klass)
|
|
193
166
|
* #gunyara-kunユーザを追加する。
|
194
167
|
* gunyara_kun = users.add(:name => "gunyara-kun",
|
195
168
|
* :uri => "http://d.hatena.ne.jp/tasukuchan/")
|
169
|
+
* @overload add(values=nil)
|
170
|
+
* @return [Groonga::Recordまたはnil]
|
171
|
+
*
|
196
172
|
*/
|
197
173
|
static VALUE
|
198
174
|
rb_grn_array_add (int argc, VALUE *argv, VALUE self)
|
data/ext/groonga/rb-grn-column.c
CHANGED
@@ -31,13 +31,14 @@ VALUE rb_cGrnColumn;
|
|
31
31
|
* 加することができる。
|
32
32
|
*
|
33
33
|
* カラムには大きく分けて3種類ある。
|
34
|
-
*
|
35
|
-
*
|
36
|
-
*
|
37
|
-
*
|
38
|
-
*
|
34
|
+
*
|
35
|
+
* - {Groonga::FixSizeColumn} :=
|
36
|
+
* 固定長のデータを格納するカラム。 =:
|
37
|
+
* - {Groonga::VariableSizeColumn} :=
|
38
|
+
* 可変長のデータを格納するカラム。 =:
|
39
|
+
* - {Groonga::IndexColumn} :=
|
39
40
|
* 転置インデックスを格納するカラム。全文検索や参照元レコー
|
40
|
-
* ドの検索を行う場合はこのカラムを使用する。
|
41
|
+
* ドの検索を行う場合はこのカラムを使用する。 =:
|
41
42
|
*
|
42
43
|
* 固定長データ用カラム・可変長データ用カラムは1つのデータだ
|
43
44
|
* けを格納するか複数のデータを格納するかを選ぶことができる。
|
@@ -110,10 +111,10 @@ rb_grn_column_deconstruct (RbGrnColumn *rb_column,
|
|
110
111
|
}
|
111
112
|
|
112
113
|
/*
|
113
|
-
* call-seq:
|
114
|
-
* column.table -> Groonga::Table
|
115
|
-
*
|
116
114
|
* カラムが所属するテーブルを返す。
|
115
|
+
*
|
116
|
+
* @overload table
|
117
|
+
* @return [Groonga::Table]
|
117
118
|
*/
|
118
119
|
static VALUE
|
119
120
|
rb_grn_column_get_table (VALUE self)
|
@@ -132,14 +133,14 @@ rb_grn_column_get_table (VALUE self)
|
|
132
133
|
}
|
133
134
|
|
134
135
|
/*
|
135
|
-
*
|
136
|
-
*
|
137
|
-
*
|
138
|
-
* @example テーブル名を除いたカラム名を返す。
|
136
|
+
* テーブル名を除いたカラム名を返す。
|
137
|
+
* @example
|
139
138
|
* items = Groonga::Array.create(:name => "Items")
|
140
139
|
* title = items.define_column("title", "ShortText")
|
141
140
|
* title.name # => "Items.title"
|
142
141
|
* title.local_name # => "title"
|
142
|
+
*
|
143
|
+
* @overload local_name
|
143
144
|
*/
|
144
145
|
static VALUE
|
145
146
|
rb_grn_column_get_local_name (VALUE self)
|
@@ -171,8 +172,8 @@ rb_grn_column_get_local_name (VALUE self)
|
|
171
172
|
* カラムが所属するテーブルからブロックまたは文字列で指定し
|
172
173
|
* た条件にマッチするレコードを返す。返されたテーブルには
|
173
174
|
* +expression+ という特異メソッドがあり、指定した条件を表し
|
174
|
-
* ているGroonga::Expressionを取得できる。
|
175
|
-
* Groonga::Expression#snippetを使うことにより、指定した条件
|
175
|
+
* ている {Groonga::Expression} を取得できる。
|
176
|
+
* {Groonga::Expression#snippet} を使うことにより、指定した条件
|
176
177
|
* 用のスニペットを簡単に生成できる。
|
177
178
|
*
|
178
179
|
* bc. !!!ruby
|
@@ -190,62 +191,85 @@ rb_grn_column_get_local_name (VALUE self)
|
|
190
191
|
* end
|
191
192
|
*
|
192
193
|
* 出力例
|
194
|
+
*
|
193
195
|
* <pre>
|
194
|
-
*
|
195
|
-
*
|
196
|
-
*
|
197
|
-
*
|
196
|
+
* !!!text
|
197
|
+
* rroongaの説明文の中で「groonga」が含まれる部分
|
198
|
+
* ---
|
199
|
+
* rroongaは<em>groonga</em>のいわゆるDB-APIの層の...
|
200
|
+
* ---
|
201
|
+
* </pre>
|
198
202
|
*
|
199
203
|
* @return [Groonga::Hash] 検索結果
|
200
204
|
* @overload select(options)
|
201
205
|
* @yieldparam [Groonga::Record] record
|
202
|
-
*
|
203
|
-
*
|
204
|
-
*
|
205
|
-
*
|
206
|
-
*
|
206
|
+
* 検索条件を指定するのに、 _record_ に対して次のメソッドを使って検索条
|
207
|
+
* 件を指定できます。
|
208
|
+
*
|
209
|
+
* @==@ 、 @=~@ 、 @<@ 、 @<=@ 、 @>@ 、 @>=@ 、 @+@ 、 @-@ 、
|
210
|
+
* @*@ 、 @/@ 、 @%@ 、
|
211
|
+
* @match(query, :syntax => :query/:script, &block)@
|
212
|
+
* ( _query_ に指定した
|
213
|
+
* "grn_expr":http://groonga.org/ja/docs/reference/grn_expr.html
|
214
|
+
* とのマッチ)、
|
215
|
+
* @similar_search(text)@ ( _text_ との類似文書探索)、
|
216
|
+
* @term_extract(text)@ ( _text_ 内から _record_ の単語を抽出)
|
207
217
|
*
|
208
|
-
*
|
209
|
-
*
|
210
|
-
*
|
211
|
-
*
|
212
|
-
*
|
213
|
-
*
|
214
|
-
* [Groonga::Operator::BUT]
|
215
|
-
* マッチしたレコードを削除。
|
216
|
-
* [Groonga::Operator::ADJUST]
|
217
|
-
* マッチしたレコードのスコアを増加。
|
218
|
+
* @!macro [new] column.select.options
|
219
|
+
* @param [::Hash] options The name and value
|
220
|
+
* pairs. Omitted names are initialized as the default value.
|
221
|
+
* @option options :operator (Groonga::Operator::OR)
|
222
|
+
* マッチしたレコードをどのように扱うか。指定可能な値は以
|
223
|
+
* 下の通り。
|
218
224
|
*
|
219
|
-
*
|
220
|
-
*
|
221
|
-
*
|
225
|
+
* - Groonga::Operator::OR :=
|
226
|
+
* マッチしたレコードを追加。すでにレコードが追加され
|
227
|
+
* ている場合は何もしない。 =:
|
228
|
+
* - Groonga::Operator::AND :=
|
229
|
+
* マッチしたレコードのスコアを増加。マッチしなかった
|
230
|
+
* レコードを削除。 =:
|
231
|
+
* - Groonga::Operator::BUT :=
|
232
|
+
* マッチしたレコードを削除。 =:
|
233
|
+
* - Groonga::Operator::ADJUST :=
|
234
|
+
* マッチしたレコードのスコアを増加。 =:
|
222
235
|
*
|
223
|
-
*
|
224
|
-
*
|
236
|
+
* @option options :result
|
237
|
+
* 検索結果を格納するテーブル。マッチしたレコードが追加さ
|
238
|
+
* れていく。省略した場合は新しくテーブルを作成して返す。
|
225
239
|
*
|
226
|
-
*
|
227
|
-
*
|
240
|
+
* @option options :name
|
241
|
+
* 条件の名前。省略した場合は名前を付けない。
|
228
242
|
*
|
229
|
-
*
|
243
|
+
* @option options :syntax (:query)
|
244
|
+
* _query_ の構文。
|
230
245
|
*
|
231
|
-
*
|
232
|
-
* query構文時にプラグマを利用するかどうか。省略した場合は
|
233
|
-
* 利用する。
|
246
|
+
* 参考: {Groonga::Expression#parse} .
|
234
247
|
*
|
235
|
-
*
|
248
|
+
* @option options :allow_pragma
|
249
|
+
* query構文時にプラグマを利用するかどうか。省略した場合は
|
250
|
+
* 利用する。
|
236
251
|
*
|
237
|
-
*
|
238
|
-
* query構文時にカラム指定を利用するかどうか。省略した場合
|
239
|
-
* は利用する。
|
252
|
+
* 参考: {Groonga::Expression#parse} .
|
240
253
|
*
|
241
|
-
*
|
254
|
+
* @option options :allow_column The allow_column
|
255
|
+
* query構文時にカラム指定を利用するかどうか。省略した場合
|
256
|
+
* は利用する。
|
242
257
|
*
|
243
|
-
*
|
244
|
-
* script構文時に更新操作を利用するかどうか。省略した場合
|
245
|
-
* は利用する。
|
258
|
+
* 参考: {Groonga::Expression#parse} .
|
246
259
|
*
|
247
|
-
*
|
260
|
+
* @option options :allow_update
|
261
|
+
* script構文時に更新操作を利用するかどうか。省略した場合
|
262
|
+
* は利用する。
|
248
263
|
*
|
264
|
+
* 参考: {Groonga::Expression#parse} .
|
265
|
+
*
|
266
|
+
* @option options :allow_leading_not
|
267
|
+
* 指定語句の先頭に-を付けることで指定した語句を含まないレコードの
|
268
|
+
* 検索を有効にするかどうかを指定する。省略した場合は無効にする。
|
269
|
+
*
|
270
|
+
* 参考: {Groonga::Expression#parse} .
|
271
|
+
*
|
272
|
+
* @!macro column.select.options
|
249
273
|
* @overload select(query, options)
|
250
274
|
* @param [String] query 条件の指定
|
251
275
|
* _query_ には「[カラム名]:[演算子][値]」という書式で条件を
|
@@ -269,107 +293,11 @@ rb_grn_column_get_local_name (VALUE self)
|
|
269
293
|
* _column_ カラムが属しているテーブルの @"description"@ カラムが
|
270
294
|
* @"groonga"@ を含んでいるレコードにマッチ =:
|
271
295
|
*
|
272
|
-
*
|
273
|
-
* pairs. Omitted names are initialized as the default value.
|
274
|
-
* @option options :operator (Groonga::Operator::OR)
|
275
|
-
* マッチしたレコードをどのように扱うか。指定可能な値は以
|
276
|
-
* 下の通り。
|
277
|
-
*
|
278
|
-
* [Groonga::Operator::OR]
|
279
|
-
* マッチしたレコードを追加。すでにレコードが追加され
|
280
|
-
* ている場合は何もしない。
|
281
|
-
* [Groonga::Operator::AND]
|
282
|
-
* マッチしたレコードのスコアを増加。マッチしなかった
|
283
|
-
* レコードを削除。
|
284
|
-
* [Groonga::Operator::BUT]
|
285
|
-
* マッチしたレコードを削除。
|
286
|
-
* [Groonga::Operator::ADJUST]
|
287
|
-
* マッチしたレコードのスコアを増加。
|
288
|
-
*
|
289
|
-
* @option options :result
|
290
|
-
* 検索結果を格納するテーブル。マッチしたレコードが追加さ
|
291
|
-
* れていく。省略した場合は新しくテーブルを作成して返す。
|
292
|
-
*
|
293
|
-
* @option options :name
|
294
|
-
* 条件の名前。省略した場合は名前を付けない。
|
295
|
-
*
|
296
|
-
* @option options :syntax (:query)
|
297
|
-
* _query_ の構文。
|
298
|
-
*
|
299
|
-
* 参考: Groonga::Expression#parse.
|
300
|
-
*
|
301
|
-
* @option options :allow_pragma
|
302
|
-
* query構文時にプラグマを利用するかどうか。省略した場合は
|
303
|
-
* 利用する。
|
304
|
-
*
|
305
|
-
* 参考: Groonga::Expression#parse.
|
306
|
-
*
|
307
|
-
* @option options :allow_column The allow_column
|
308
|
-
* query構文時にカラム指定を利用するかどうか。省略した場合
|
309
|
-
* は利用する。
|
310
|
-
*
|
311
|
-
* 参考: Groonga::Expression#parse.
|
312
|
-
*
|
313
|
-
* @option options :allow_update
|
314
|
-
* script構文時に更新操作を利用するかどうか。省略した場合
|
315
|
-
* は利用する。
|
316
|
-
*
|
317
|
-
* 参考: Groonga::Expression#parse.
|
318
|
-
*
|
296
|
+
* @!macro column.select.options
|
319
297
|
* @overload select(expression, options)
|
320
298
|
* @param [Groonga::Expression] expression 条件を表すオブジェクト
|
321
|
-
* _expression_ には既に作成済みのGroonga::Expression
|
322
|
-
*
|
323
|
-
* ブロックで条件を指定する場合は
|
324
|
-
* {Groonga::ColumnExpressionBuilder} を参照。
|
325
|
-
*
|
326
|
-
* @param [::Hash] options The name and value
|
327
|
-
* pairs. Omitted names are initialized as the default value.
|
328
|
-
* @option options :operator (Groonga::Operator::OR)
|
329
|
-
* マッチしたレコードをどのように扱うか。指定可能な値は以
|
330
|
-
* 下の通り。
|
331
|
-
*
|
332
|
-
* [Groonga::Operator::OR]
|
333
|
-
* マッチしたレコードを追加。すでにレコードが追加され
|
334
|
-
* ている場合は何もしない。
|
335
|
-
* [Groonga::Operator::AND]
|
336
|
-
* マッチしたレコードのスコアを増加。マッチしなかった
|
337
|
-
* レコードを削除。
|
338
|
-
* [Groonga::Operator::BUT]
|
339
|
-
* マッチしたレコードを削除。
|
340
|
-
* [Groonga::Operator::ADJUST]
|
341
|
-
* マッチしたレコードのスコアを増加。
|
342
|
-
*
|
343
|
-
* @option options :result
|
344
|
-
* 検索結果を格納するテーブル。マッチしたレコードが追加さ
|
345
|
-
* れていく。省略した場合は新しくテーブルを作成して返す。
|
346
|
-
*
|
347
|
-
* @option options :name
|
348
|
-
* 条件の名前。省略した場合は名前を付けない。
|
349
|
-
*
|
350
|
-
* @option options :syntax (:query)
|
351
|
-
* _query_ の構文。
|
352
|
-
*
|
353
|
-
* 参考: Groonga::Expression#parse.
|
354
|
-
*
|
355
|
-
* @option options :allow_pragma
|
356
|
-
* query構文時にプラグマを利用するかどうか。省略した場合は
|
357
|
-
* 利用する。
|
358
|
-
*
|
359
|
-
* 参考: Groonga::Expression#parse.
|
360
|
-
*
|
361
|
-
* @option options :allow_column The allow_column
|
362
|
-
* query構文時にカラム指定を利用するかどうか。省略した場合
|
363
|
-
* は利用する。
|
364
|
-
*
|
365
|
-
* 参考: Groonga::Expression#parse.
|
366
|
-
*
|
367
|
-
* @option options :allow_update
|
368
|
-
* script構文時に更新操作を利用するかどうか。省略した場合
|
369
|
-
* は利用する。
|
370
|
-
*
|
371
|
-
* 参考: Groonga::Expression#parse.
|
372
|
-
*
|
299
|
+
* _expression_ には既に作成済みの {Groonga::Expression} を渡す。
|
300
|
+
* @!macro column.select.options
|
373
301
|
*/
|
374
302
|
static VALUE
|
375
303
|
rb_grn_column_select (int argc, VALUE *argv, VALUE self)
|
@@ -380,7 +308,7 @@ rb_grn_column_select (int argc, VALUE *argv, VALUE self)
|
|
380
308
|
VALUE options;
|
381
309
|
VALUE rb_query, condition_or_options;
|
382
310
|
VALUE rb_name, rb_operator, rb_result, rb_syntax;
|
383
|
-
VALUE rb_allow_pragma, rb_allow_column, rb_allow_update;
|
311
|
+
VALUE rb_allow_pragma, rb_allow_column, rb_allow_update, rb_allow_leading_not;
|
384
312
|
VALUE builder;
|
385
313
|
VALUE rb_expression = Qnil;
|
386
314
|
|
@@ -416,6 +344,7 @@ rb_grn_column_select (int argc, VALUE *argv, VALUE self)
|
|
416
344
|
"allow_pragma", &rb_allow_pragma,
|
417
345
|
"allow_column", &rb_allow_column,
|
418
346
|
"allow_update", &rb_allow_update,
|
347
|
+
"allow_leading_not", &rb_allow_leading_not,
|
419
348
|
NULL);
|
420
349
|
|
421
350
|
if (!NIL_P(rb_operator))
|
@@ -437,6 +366,7 @@ rb_grn_column_select (int argc, VALUE *argv, VALUE self)
|
|
437
366
|
rb_funcall(builder, rb_intern("allow_pragma="), 1, rb_allow_pragma);
|
438
367
|
rb_funcall(builder, rb_intern("allow_column="), 1, rb_allow_column);
|
439
368
|
rb_funcall(builder, rb_intern("allow_update="), 1, rb_allow_update);
|
369
|
+
rb_funcall(builder, rb_intern("allow_leading_not="), 1, rb_allow_leading_not);
|
440
370
|
rb_expression = rb_grn_column_expression_builder_build(builder);
|
441
371
|
}
|
442
372
|
rb_grn_object_deconstruct(RB_GRN_OBJECT(DATA_PTR(rb_expression)),
|
@@ -499,27 +429,22 @@ rb_grn_column_unlock_ensure (VALUE self)
|
|
499
429
|
|
500
430
|
/*
|
501
431
|
* _column_ をロックする。ロックに失敗した場合は
|
502
|
-
* Groonga::ResourceDeadlockAvoided例外が発生する。
|
432
|
+
* {Groonga::ResourceDeadlockAvoided} 例外が発生する。
|
503
433
|
*
|
504
434
|
* @overload lock(options={})
|
505
|
-
*
|
506
|
-
*
|
507
|
-
*
|
508
|
-
*
|
509
|
-
*
|
510
|
-
*
|
511
|
-
*
|
512
|
-
*
|
435
|
+
* @!macro [new] column.lock.options
|
436
|
+
* @param [::Hash] options 利用可能なオプションは以下の通り。
|
437
|
+
* @option options :timeout
|
438
|
+
* ロックを獲得できなかった場合は _:timeout_ 秒間ロックの獲
|
439
|
+
* 得を試みる。 _:timeout_ 秒以内にロックを獲得できなかった
|
440
|
+
* 場合は例外が発生する。
|
441
|
+
* @option options :id
|
442
|
+
* _:id_で指定したレコードをロックする。(注: groonga側が
|
443
|
+
* 未実装のため、現在は無視される)
|
444
|
+
* @!macro column.lock.options
|
513
445
|
* @overload lock(options={})
|
514
446
|
* @yield ブロックを指定した場合はブロックを抜けたときにunlockする。
|
515
|
-
*
|
516
|
-
* @option options :timeout
|
517
|
-
* ロックを獲得できなかった場合は _:timeout_秒間ロックの獲
|
518
|
-
* 得を試みる。 _:timeout_秒以内にロックを獲得できなかった
|
519
|
-
* 場合は例外が発生する。
|
520
|
-
* @option options :id
|
521
|
-
* _:id_で指定したレコードをロックする。(注: groonga側が
|
522
|
-
* 未実装のため、現在は無視される)
|
447
|
+
* @!macro column.lock.options
|
523
448
|
*/
|
524
449
|
static VALUE
|
525
450
|
rb_grn_column_lock (int argc, VALUE *argv, VALUE self)
|
@@ -630,15 +555,12 @@ rb_grn_column_is_locked (int argc, VALUE *argv, VALUE self)
|
|
630
555
|
}
|
631
556
|
|
632
557
|
/*
|
633
|
-
* Document-method: reference?
|
634
|
-
*
|
635
|
-
* call-seq:
|
636
|
-
* column.reference? -> true/false
|
637
|
-
*
|
638
558
|
* _column_ の値がテーブルのレコードとなる場合は +true+ を返し、
|
639
559
|
* そうでない場合は +false+ を返す。
|
640
560
|
*
|
641
561
|
* @since 1.0.5
|
562
|
+
*
|
563
|
+
* @overload reference?
|
642
564
|
*/
|
643
565
|
static VALUE
|
644
566
|
rb_grn_column_reference_p (VALUE self)
|
@@ -668,15 +590,12 @@ rb_grn_column_reference_p (VALUE self)
|
|
668
590
|
}
|
669
591
|
|
670
592
|
/*
|
671
|
-
*
|
672
|
-
*
|
673
|
-
* call-seq:
|
674
|
-
* column.index? -> true/false
|
675
|
-
*
|
676
|
-
* _column_ がGroonga::IndexColumnの場合は +true+ を返し、
|
593
|
+
* _column_ が {Groonga::IndexColumn} の場合は +true+ を返し、
|
677
594
|
* そうでない場合は +false+ を返す。
|
678
595
|
*
|
679
596
|
* @since 1.0.5
|
597
|
+
*
|
598
|
+
* @overload index?
|
680
599
|
*/
|
681
600
|
static VALUE
|
682
601
|
rb_grn_column_index_p (VALUE self)
|
@@ -696,15 +615,12 @@ rb_grn_column_index_p (VALUE self)
|
|
696
615
|
}
|
697
616
|
|
698
617
|
/*
|
699
|
-
* Document-method: vector?
|
700
|
-
*
|
701
|
-
* call-seq:
|
702
|
-
* column.vector? -> true/false
|
703
|
-
*
|
704
618
|
* _column_ がベクターカラムの場合は +true+ を返し、
|
705
619
|
* そうでない場合は +false+ を返す。
|
706
620
|
*
|
707
621
|
* @since 1.0.5
|
622
|
+
*
|
623
|
+
* @overload vector?
|
708
624
|
*/
|
709
625
|
static VALUE
|
710
626
|
rb_grn_column_vector_p (VALUE self)
|
@@ -726,15 +642,12 @@ rb_grn_column_vector_p (VALUE self)
|
|
726
642
|
}
|
727
643
|
|
728
644
|
/*
|
729
|
-
* Document-method: scalar?
|
730
|
-
*
|
731
|
-
* call-seq:
|
732
|
-
* column.scalar? -> true/false
|
733
|
-
*
|
734
645
|
* _column_ がスカラーカラムの場合は +true+ を返し、
|
735
646
|
* そうでない場合は +false+ を返す。
|
736
647
|
*
|
737
648
|
* @since 1.0.5
|
649
|
+
*
|
650
|
+
* @overload scalar?
|
738
651
|
*/
|
739
652
|
static VALUE
|
740
653
|
rb_grn_column_scalar_p (VALUE self)
|