rroonga 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/Gemfile +20 -0
- data/Rakefile +187 -0
- data/doc/text/news.textile +10 -2
- data/doc/text/tutorial.textile +0 -2
- data/ext/groonga/extconf.rb +7 -1
- data/ext/groonga/rb-grn-accessor.c +11 -11
- data/ext/groonga/rb-grn-array.c +25 -25
- data/ext/groonga/rb-grn-column.c +106 -106
- data/ext/groonga/rb-grn-context.c +121 -121
- data/ext/groonga/rb-grn-database.c +78 -78
- data/ext/groonga/rb-grn-double-array-trie.c +92 -92
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +28 -28
- data/ext/groonga/rb-grn-exception.c +9 -9
- data/ext/groonga/rb-grn-expression-builder.c +6 -6
- data/ext/groonga/rb-grn-expression.c +87 -87
- data/ext/groonga/rb-grn-fix-size-column.c +12 -12
- data/ext/groonga/rb-grn-geo-point.c +2 -2
- data/ext/groonga/rb-grn-hash.c +38 -38
- data/ext/groonga/rb-grn-index-column.c +191 -191
- data/ext/groonga/rb-grn-index-cursor.c +29 -29
- data/ext/groonga/rb-grn-logger.c +36 -36
- data/ext/groonga/rb-grn-normalizer.c +10 -10
- data/ext/groonga/rb-grn-patricia-trie.c +196 -196
- data/ext/groonga/rb-grn-plugin.c +5 -5
- data/ext/groonga/rb-grn-posting.c +2 -2
- data/ext/groonga/rb-grn-procedure.c +2 -2
- data/ext/groonga/rb-grn-query-logger.c +1 -1
- data/ext/groonga/rb-grn-record.c +1 -1
- data/ext/groonga/rb-grn-snippet.c +14 -14
- data/ext/groonga/rb-grn-table-cursor-key-support.c +4 -4
- data/ext/groonga/rb-grn-table-cursor.c +52 -52
- data/ext/groonga/rb-grn-table-key-support.c +209 -209
- data/ext/groonga/rb-grn-type.c +18 -18
- data/ext/groonga/rb-grn-utils.c +332 -314
- data/ext/groonga/rb-grn-variable-size-column.c +34 -34
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn.h +240 -232
- data/ext/groonga/rb-groonga.c +10 -10
- data/rroonga-build.rb +7 -0
- data/rroonga.gemspec +1 -1
- data/test/test-hash.rb +4 -4
- data/test/test-index-column.rb +271 -257
- data/test/test-table-key-support.rb +78 -0
- data/test/test-table.rb +78 -51
- metadata +195 -164
- checksums.yaml +0 -7
data/ext/groonga/rb-grn-hash.c
CHANGED
@@ -163,61 +163,61 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
163
163
|
rb_scan_args(argc, argv, "01", &options);
|
164
164
|
|
165
165
|
rb_grn_scan_options(options,
|
166
|
-
|
167
|
-
|
166
|
+
"context", &rb_context,
|
167
|
+
"name", &rb_name,
|
168
168
|
"path", &rb_path,
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
"persistent", &rb_persistent,
|
170
|
+
"key_normalize", &rb_key_normalize,
|
171
|
+
"key_type", &rb_key_type,
|
172
|
+
"value_type", &rb_value_type,
|
173
|
+
"default_tokenizer", &rb_default_tokenizer,
|
174
|
+
"sub_records", &rb_sub_records,
|
175
|
+
"normalizer", &rb_normalizer,
|
176
|
+
NULL);
|
177
177
|
|
178
178
|
context = rb_grn_context_ensure(&rb_context);
|
179
179
|
|
180
180
|
if (!NIL_P(rb_name)) {
|
181
181
|
name = StringValuePtr(rb_name);
|
182
|
-
|
183
|
-
|
182
|
+
name_size = RSTRING_LEN(rb_name);
|
183
|
+
flags |= GRN_OBJ_PERSISTENT;
|
184
184
|
}
|
185
185
|
|
186
186
|
if (!NIL_P(rb_path)) {
|
187
187
|
path = StringValueCStr(rb_path);
|
188
|
-
|
188
|
+
flags |= GRN_OBJ_PERSISTENT;
|
189
189
|
}
|
190
190
|
|
191
191
|
if (RVAL2CBOOL(rb_persistent))
|
192
|
-
|
192
|
+
flags |= GRN_OBJ_PERSISTENT;
|
193
193
|
|
194
194
|
if (RVAL2CBOOL(rb_key_normalize))
|
195
|
-
|
195
|
+
flags |= GRN_OBJ_KEY_NORMALIZE;
|
196
196
|
|
197
197
|
if (NIL_P(rb_key_type)) {
|
198
|
-
|
198
|
+
key_type = grn_ctx_at(context, GRN_DB_SHORT_TEXT);
|
199
199
|
} else {
|
200
|
-
|
200
|
+
key_type = RVAL2GRNOBJECT(rb_key_type, &context);
|
201
201
|
}
|
202
202
|
|
203
203
|
if (!NIL_P(rb_value_type))
|
204
|
-
|
204
|
+
value_type = RVAL2GRNOBJECT(rb_value_type, &context);
|
205
205
|
|
206
206
|
if (RVAL2CBOOL(rb_sub_records))
|
207
|
-
|
207
|
+
flags |= GRN_OBJ_WITH_SUBREC;
|
208
208
|
|
209
209
|
table = grn_table_create(context, name, name_size, path,
|
210
|
-
|
210
|
+
flags, key_type, value_type);
|
211
211
|
if (!table)
|
212
|
-
|
212
|
+
rb_grn_context_check(context, rb_ary_new4(argc, argv));
|
213
213
|
rb_table = GRNOBJECT2RVAL(klass, context, table, GRN_TRUE);
|
214
214
|
|
215
215
|
if (!NIL_P(rb_default_tokenizer))
|
216
|
-
|
217
|
-
|
216
|
+
rb_funcall(rb_table, rb_intern("default_tokenizer="), 1,
|
217
|
+
rb_default_tokenizer);
|
218
218
|
if (!NIL_P(rb_normalizer))
|
219
|
-
|
220
|
-
|
219
|
+
rb_funcall(rb_table, rb_intern("normalizer="), 1,
|
220
|
+
rb_normalizer);
|
221
221
|
|
222
222
|
if (rb_block_given_p())
|
223
223
|
return rb_ensure(rb_yield, rb_table, rb_grn_object_close, rb_table);
|
@@ -263,30 +263,30 @@ rb_grn_hash_search (int argc, VALUE *argv, VALUE self)
|
|
263
263
|
VALUE rb_key, options, rb_result;
|
264
264
|
|
265
265
|
rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
|
266
|
-
|
267
|
-
|
268
|
-
|
266
|
+
&key, &domain_id, &domain,
|
267
|
+
NULL, NULL, NULL,
|
268
|
+
NULL);
|
269
269
|
|
270
270
|
rb_scan_args(argc, argv, "11", &rb_key, &options);
|
271
271
|
|
272
272
|
RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
|
273
273
|
|
274
274
|
rb_grn_scan_options(options,
|
275
|
-
|
276
|
-
|
275
|
+
"result", &rb_result,
|
276
|
+
NULL);
|
277
277
|
|
278
278
|
if (NIL_P(rb_result)) {
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
279
|
+
result = grn_table_create(context, NULL, 0, NULL,
|
280
|
+
GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
|
281
|
+
table, 0);
|
282
|
+
rb_grn_context_check(context, self);
|
283
|
+
rb_result = GRNOBJECT2RVAL(Qnil, context, result, GRN_TRUE);
|
284
284
|
} else {
|
285
|
-
|
285
|
+
result = RVAL2GRNOBJECT(rb_result, &context);
|
286
286
|
}
|
287
287
|
|
288
288
|
rc = grn_obj_search(context, table, key,
|
289
|
-
|
289
|
+
result, GRN_OP_OR, NULL);
|
290
290
|
rb_grn_rc_check(rc, self);
|
291
291
|
|
292
292
|
return rb_result;
|
@@ -300,7 +300,7 @@ rb_grn_init_hash (VALUE mGrn)
|
|
300
300
|
rb_include_module(rb_cGrnHash, rb_mGrnTableKeySupport);
|
301
301
|
|
302
302
|
rb_define_singleton_method(rb_cGrnHash, "create",
|
303
|
-
|
303
|
+
rb_grn_hash_s_create, -1);
|
304
304
|
|
305
305
|
rb_define_method(rb_cGrnHash, "search", rb_grn_hash_search, -1);
|
306
306
|
}
|