rroonga 3.0.5-x86-mingw32 → 3.0.6-x86-mingw32
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 +7 -0
- 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/lib/1.9/groonga.so +0 -0
- data/lib/2.0/groonga.so +0 -0
- 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 +8 -3
@@ -59,5 +59,5 @@ rb_grn_init_encoding_support (VALUE mGrn)
|
|
59
59
|
rb_mGrnEncodingSupport = rb_define_module_under(mGrn, "EncodingSupport");
|
60
60
|
|
61
61
|
rb_define_method(rb_mGrnEncodingSupport, "encoding",
|
62
|
-
|
62
|
+
rb_grn_encoding_support_get_encoding, 0);
|
63
63
|
}
|
@@ -82,10 +82,10 @@ grn_encoding
|
|
82
82
|
rb_grn_encoding_from_ruby_object (VALUE object, grn_ctx *context)
|
83
83
|
{
|
84
84
|
if (NIL_P(object)) {
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
if (context)
|
86
|
+
return context->encoding;
|
87
|
+
else
|
88
|
+
return GRN_ENC_DEFAULT;
|
89
89
|
}
|
90
90
|
|
91
91
|
if (rb_grn_equal_option(object, "default")) {
|
@@ -93,14 +93,14 @@ rb_grn_encoding_from_ruby_object (VALUE object, grn_ctx *context)
|
|
93
93
|
} else if (rb_grn_equal_option(object, "none")) {
|
94
94
|
return GRN_ENC_NONE;
|
95
95
|
} else if (rb_grn_equal_option(object, "euc_jp") ||
|
96
|
-
|
96
|
+
rb_grn_equal_option(object, "euc-jp")) {
|
97
97
|
return GRN_ENC_EUC_JP;
|
98
98
|
} else if (rb_grn_equal_option(object, "utf8") ||
|
99
|
-
|
99
|
+
rb_grn_equal_option(object, "utf-8")) {
|
100
100
|
return GRN_ENC_UTF8;
|
101
101
|
} else if (rb_grn_equal_option(object, "sjis") ||
|
102
|
-
|
103
|
-
|
102
|
+
rb_grn_equal_option(object, "shift_jis") ||
|
103
|
+
rb_grn_equal_option(object, "shift-jis")) {
|
104
104
|
return GRN_ENC_SJIS;
|
105
105
|
} else if (rb_grn_equal_option(object, "latin1")) {
|
106
106
|
return GRN_ENC_LATIN1;
|
@@ -120,29 +120,29 @@ rb_grn_encoding_to_ruby_object (grn_encoding encoding)
|
|
120
120
|
|
121
121
|
switch (encoding) {
|
122
122
|
case GRN_ENC_DEFAULT:
|
123
|
-
|
123
|
+
rb_encoding = RB_GRN_ENCODING_DEFAULT;
|
124
124
|
break;
|
125
125
|
case GRN_ENC_NONE:
|
126
|
-
|
126
|
+
rb_encoding = RB_GRN_ENCODING_NONE;
|
127
127
|
break;
|
128
128
|
case GRN_ENC_EUC_JP:
|
129
|
-
|
129
|
+
rb_encoding = RB_GRN_ENCODING_EUC_JP;
|
130
130
|
break;
|
131
131
|
case GRN_ENC_UTF8:
|
132
|
-
|
132
|
+
rb_encoding = RB_GRN_ENCODING_UTF8;
|
133
133
|
break;
|
134
134
|
case GRN_ENC_SJIS:
|
135
|
-
|
135
|
+
rb_encoding = RB_GRN_ENCODING_SJIS;
|
136
136
|
break;
|
137
137
|
case GRN_ENC_LATIN1:
|
138
|
-
|
138
|
+
rb_encoding = RB_GRN_ENCODING_LATIN1;
|
139
139
|
break;
|
140
140
|
case GRN_ENC_KOI8R:
|
141
|
-
|
141
|
+
rb_encoding = RB_GRN_ENCODING_KOI8R;
|
142
142
|
break;
|
143
143
|
default:
|
144
|
-
|
145
|
-
|
144
|
+
rb_raise(rb_eArgError, "unknown encoding: %d", encoding);
|
145
|
+
break;
|
146
146
|
}
|
147
147
|
|
148
148
|
return rb_encoding;
|
@@ -155,30 +155,30 @@ rb_grn_encoding_to_ruby_encoding (grn_encoding encoding)
|
|
155
155
|
rb_encoding *rb_encoding;
|
156
156
|
|
157
157
|
if (encoding == GRN_ENC_DEFAULT)
|
158
|
-
|
158
|
+
encoding = grn_get_default_encoding();
|
159
159
|
|
160
160
|
switch (encoding) {
|
161
161
|
case GRN_ENC_NONE:
|
162
|
-
|
162
|
+
rb_encoding = rb_ascii8bit_encoding();
|
163
163
|
break;
|
164
164
|
case GRN_ENC_EUC_JP:
|
165
|
-
|
165
|
+
rb_encoding = rb_enc_find("euc-jp");
|
166
166
|
break;
|
167
167
|
case GRN_ENC_UTF8:
|
168
|
-
|
168
|
+
rb_encoding = rb_utf8_encoding();
|
169
169
|
break;
|
170
170
|
case GRN_ENC_SJIS:
|
171
|
-
|
171
|
+
rb_encoding = rb_enc_find("CP932");
|
172
172
|
break;
|
173
173
|
case GRN_ENC_LATIN1:
|
174
|
-
|
174
|
+
rb_encoding = rb_enc_find("ISO-8859-1");
|
175
175
|
break;
|
176
176
|
case GRN_ENC_KOI8R:
|
177
|
-
|
177
|
+
rb_encoding = rb_enc_find("KOI8-R");
|
178
178
|
break;
|
179
179
|
default:
|
180
|
-
|
181
|
-
|
180
|
+
rb_raise(rb_eArgError, "unknown encoding: %d", encoding);
|
181
|
+
break;
|
182
182
|
}
|
183
183
|
|
184
184
|
return rb_encoding;
|
@@ -222,9 +222,9 @@ rb_grn_init_encoding (VALUE mGrn)
|
|
222
222
|
mGrnEncoding = rb_define_module_under(mGrn, "Encoding");
|
223
223
|
|
224
224
|
rb_define_singleton_method(mGrnEncoding, "default",
|
225
|
-
|
225
|
+
rb_grn_encoding_s_get_default, 0);
|
226
226
|
rb_define_singleton_method(mGrnEncoding, "default=",
|
227
|
-
|
227
|
+
rb_grn_encoding_s_set_default, 1);
|
228
228
|
|
229
229
|
#define DEFINE_ENCODING(name, value) \
|
230
230
|
RB_GRN_ENCODING_ ## name = RB_GRN_INTERN(value); \
|
@@ -103,7 +103,7 @@ rb_grn_rc_to_exception (grn_rc rc)
|
|
103
103
|
|
104
104
|
switch (rc) {
|
105
105
|
case GRN_SUCCESS:
|
106
|
-
|
106
|
+
return Qnil;
|
107
107
|
break;
|
108
108
|
case GRN_END_OF_DATA:
|
109
109
|
exception = eGrnEndOfData;
|
@@ -339,8 +339,8 @@ rb_grn_rc_to_message (grn_rc rc)
|
|
339
339
|
|
340
340
|
switch (rc) {
|
341
341
|
case GRN_SUCCESS:
|
342
|
-
|
343
|
-
|
342
|
+
return NULL;
|
343
|
+
break;
|
344
344
|
case GRN_END_OF_DATA:
|
345
345
|
message = "end of data";
|
346
346
|
break;
|
@@ -576,13 +576,13 @@ rb_grn_rc_check (grn_rc rc, VALUE related_object)
|
|
576
576
|
|
577
577
|
exception = rb_grn_rc_to_exception(rc);
|
578
578
|
if (NIL_P(exception))
|
579
|
-
|
579
|
+
return;
|
580
580
|
message = rb_grn_rc_to_message(rc);
|
581
581
|
|
582
582
|
if (NIL_P(related_object))
|
583
|
-
|
583
|
+
rb_raise(exception, "%s", message);
|
584
584
|
else
|
585
|
-
|
585
|
+
rb_raise(exception, "%s: %s", rb_grn_inspect(related_object), message);
|
586
586
|
}
|
587
587
|
|
588
588
|
void
|
@@ -727,7 +727,7 @@ rb_grn_init_exception (VALUE mGrn)
|
|
727
727
|
*/
|
728
728
|
eGrnResourceTemporarilyUnavailable =
|
729
729
|
rb_define_class_under(mGrn, "ResourceTemporarilyUnavailable",
|
730
|
-
|
730
|
+
rb_eGrnError);
|
731
731
|
|
732
732
|
/*
|
733
733
|
* Document-class: Groonga::NotEnoughSpace
|
@@ -1198,7 +1198,7 @@ rb_grn_init_exception (VALUE mGrn)
|
|
1198
1198
|
* 未サポートのコマンドバージョンを指定したときに発生する。
|
1199
1199
|
*/
|
1200
1200
|
eGrnUnsupportedCommandVersion =
|
1201
|
-
|
1201
|
+
rb_define_class_under(mGrn, "UnsupportedCommandVersion", rb_eGrnError);
|
1202
1202
|
|
1203
1203
|
/*
|
1204
1204
|
* Document-class: Groonga::NormalizerError
|
@@ -1208,5 +1208,5 @@ rb_grn_init_exception (VALUE mGrn)
|
|
1208
1208
|
* @since 2.1.0
|
1209
1209
|
*/
|
1210
1210
|
eGrnNormalizerError =
|
1211
|
-
|
1211
|
+
rb_define_class_under(mGrn, "NormalizerError", rb_eGrnError);
|
1212
1212
|
}
|
@@ -25,14 +25,14 @@ VALUE
|
|
25
25
|
rb_grn_record_expression_builder_new (VALUE table, VALUE name)
|
26
26
|
{
|
27
27
|
return rb_funcall(rb_cGrnRecordExpressionBuilder,
|
28
|
-
|
28
|
+
rb_intern("new"), 2, table, name);
|
29
29
|
}
|
30
30
|
|
31
31
|
VALUE
|
32
32
|
rb_grn_column_expression_builder_new (VALUE column, VALUE name, VALUE query)
|
33
33
|
{
|
34
34
|
return rb_funcall(rb_cGrnColumnExpressionBuilder,
|
35
|
-
|
35
|
+
rb_intern("new"), 3, column, name, query);
|
36
36
|
}
|
37
37
|
|
38
38
|
static VALUE
|
@@ -51,18 +51,18 @@ VALUE
|
|
51
51
|
rb_grn_record_expression_builder_build (VALUE self)
|
52
52
|
{
|
53
53
|
if (rb_block_given_p())
|
54
|
-
|
54
|
+
return rb_iterate(build, self, build_block, self);
|
55
55
|
else
|
56
|
-
|
56
|
+
return build(self);
|
57
57
|
}
|
58
58
|
|
59
59
|
VALUE
|
60
60
|
rb_grn_column_expression_builder_build (VALUE self)
|
61
61
|
{
|
62
62
|
if (rb_block_given_p())
|
63
|
-
|
63
|
+
return rb_iterate(build, self, build_block, self);
|
64
64
|
else
|
65
|
-
|
65
|
+
return build(self);
|
66
66
|
}
|
67
67
|
|
68
68
|
void
|
@@ -31,10 +31,10 @@ VALUE rb_cGrnExpression;
|
|
31
31
|
|
32
32
|
void
|
33
33
|
rb_grn_expression_finalizer (grn_ctx *context, grn_obj *object,
|
34
|
-
|
34
|
+
RbGrnExpression *rb_grn_expression)
|
35
35
|
{
|
36
36
|
if (context && rb_grn_expression->value)
|
37
|
-
|
37
|
+
grn_obj_unlink(context, rb_grn_expression->value);
|
38
38
|
|
39
39
|
rb_grn_context_unregister_floating_object(RB_GRN_OBJECT(rb_grn_expression));
|
40
40
|
|
@@ -59,7 +59,7 @@ rb_grn_expression_deconstruct (RbGrnExpression *rb_grn_expression,
|
|
59
59
|
grn_ctx **context,
|
60
60
|
grn_id *domain_id,
|
61
61
|
grn_obj **domain,
|
62
|
-
|
62
|
+
grn_obj **value,
|
63
63
|
grn_id *range_id,
|
64
64
|
grn_obj **range)
|
65
65
|
{
|
@@ -67,11 +67,11 @@ rb_grn_expression_deconstruct (RbGrnExpression *rb_grn_expression,
|
|
67
67
|
|
68
68
|
rb_grn_object = RB_GRN_OBJECT(rb_grn_expression);
|
69
69
|
rb_grn_object_deconstruct(rb_grn_object, expression, context,
|
70
|
-
|
71
|
-
|
70
|
+
domain_id, domain,
|
71
|
+
range_id, range);
|
72
72
|
|
73
73
|
if (value)
|
74
|
-
|
74
|
+
*value = rb_grn_expression->value;
|
75
75
|
}
|
76
76
|
|
77
77
|
static VALUE
|
@@ -92,8 +92,8 @@ rb_grn_expression_initialize (int argc, VALUE *argv, VALUE self)
|
|
92
92
|
context = rb_grn_context_ensure(&rb_context);
|
93
93
|
|
94
94
|
if (!NIL_P(rb_name)) {
|
95
|
-
|
96
|
-
|
95
|
+
name = StringValuePtr(rb_name);
|
96
|
+
name_size = RSTRING_LEN(rb_name);
|
97
97
|
}
|
98
98
|
|
99
99
|
expression = grn_expr_create(context, name, name_size);
|
@@ -139,23 +139,23 @@ rb_grn_expression_define_variable (int argc, VALUE *argv, VALUE self)
|
|
139
139
|
NULL, NULL, NULL);
|
140
140
|
|
141
141
|
rb_grn_scan_options(options,
|
142
|
-
|
143
|
-
|
142
|
+
"name", &rb_name,
|
143
|
+
"domain", &rb_domain,
|
144
144
|
"reference", &rb_reference,
|
145
|
-
|
145
|
+
NULL);
|
146
146
|
|
147
147
|
if (!NIL_P(rb_name)) {
|
148
|
-
|
149
|
-
|
148
|
+
name = StringValuePtr(rb_name);
|
149
|
+
name_size = RSTRING_LEN(rb_name);
|
150
150
|
}
|
151
151
|
|
152
152
|
variable = grn_expr_add_var(context, expression, name, name_size);
|
153
153
|
rb_variable = GRNVARIABLE2RVAL(context, variable);
|
154
154
|
|
155
155
|
if (RVAL2CBOOL(rb_obj_is_kind_of(rb_domain, rb_cGrnTable))) {
|
156
|
-
|
157
|
-
|
158
|
-
|
156
|
+
grn_id domain_id;
|
157
|
+
domain_id = NUM2UINT(rb_funcall(rb_domain, rb_intern("id"), 0));
|
158
|
+
GRN_RECORD_INIT(variable, 0, domain_id);
|
159
159
|
} else if (!NIL_P(rb_reference) && RVAL2CBOOL(rb_reference)) {
|
160
160
|
GRN_PTR_INIT(variable, 0, GRN_DB_OBJECT);
|
161
161
|
}
|
@@ -228,7 +228,7 @@ rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
|
228
228
|
|
229
229
|
rb_grn_expression_deconstruct(SELF(self), &expression, &context,
|
230
230
|
NULL, NULL, NULL,
|
231
|
-
|
231
|
+
NULL, NULL);
|
232
232
|
|
233
233
|
RVAL2GRNOBJ(rb_constant, context, &constant);
|
234
234
|
grn_expr_append_const(context, expression, constant, operator, n_arguments);
|
@@ -236,7 +236,7 @@ rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
|
236
236
|
exception = rb_grn_context_to_exception(context, self);
|
237
237
|
grn_obj_unlink(context, constant);
|
238
238
|
if (!NIL_P(exception))
|
239
|
-
|
239
|
+
rb_exc_raise(exception);
|
240
240
|
|
241
241
|
return self;
|
242
242
|
}
|
@@ -248,7 +248,7 @@ rb_grn_expression_append_constant (int argc, VALUE *argv, VALUE self)
|
|
248
248
|
*/
|
249
249
|
static VALUE
|
250
250
|
rb_grn_expression_append_operation (VALUE self, VALUE rb_operation,
|
251
|
-
|
251
|
+
VALUE rb_n_arguments)
|
252
252
|
{
|
253
253
|
grn_ctx *context = NULL;
|
254
254
|
grn_obj *expression;
|
@@ -355,11 +355,11 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
355
355
|
"default_column", &rb_default_column,
|
356
356
|
"default_operator", &rb_default_operator,
|
357
357
|
"default_mode", &rb_default_mode,
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
358
|
+
"syntax", &rb_syntax,
|
359
|
+
"allow_pragma", &rb_allow_pragma,
|
360
|
+
"allow_column", &rb_allow_column,
|
361
|
+
"allow_update", &rb_allow_update,
|
362
|
+
"allow_leading_not", &rb_allow_leading_not,
|
363
363
|
NULL);
|
364
364
|
|
365
365
|
query = StringValuePtr(rb_query);
|
@@ -370,79 +370,79 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
370
370
|
NULL, NULL, NULL);
|
371
371
|
|
372
372
|
if (NIL_P(rb_default_column)) {
|
373
|
-
|
373
|
+
default_column = NULL;
|
374
374
|
} else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_default_column, rb_cGrnObject))) {
|
375
|
-
|
375
|
+
default_column = RVAL2GRNOBJECT(rb_default_column, &context);
|
376
376
|
} else {
|
377
|
-
|
378
|
-
|
377
|
+
default_column = RVAL2GRNBULK(rb_default_column, context, NULL);
|
378
|
+
default_column_is_created = GRN_TRUE;
|
379
379
|
}
|
380
380
|
|
381
381
|
if (!NIL_P(rb_default_mode))
|
382
|
-
|
382
|
+
default_mode = RVAL2GRNOPERATOR(rb_default_mode);
|
383
383
|
if (!NIL_P(rb_default_operator))
|
384
|
-
|
384
|
+
default_operator = RVAL2GRNOPERATOR(rb_default_operator);
|
385
385
|
|
386
386
|
if (NIL_P(rb_syntax) ||
|
387
|
-
|
388
|
-
|
387
|
+
rb_grn_equal_option(rb_syntax, "query")) {
|
388
|
+
flags = GRN_EXPR_SYNTAX_QUERY;
|
389
389
|
} else if (rb_grn_equal_option(rb_syntax, "script")) {
|
390
|
-
|
390
|
+
flags = GRN_EXPR_SYNTAX_SCRIPT;
|
391
391
|
} else {
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
392
|
+
rb_raise(rb_eArgError,
|
393
|
+
"syntax should be one of "
|
394
|
+
"[nil, :query, :script]: %s",
|
395
|
+
rb_grn_inspect(rb_syntax));
|
396
396
|
}
|
397
397
|
|
398
398
|
if (NIL_P(rb_allow_pragma)) {
|
399
|
-
|
400
|
-
|
399
|
+
if (!(flags & GRN_EXPR_SYNTAX_SCRIPT))
|
400
|
+
flags |= GRN_EXPR_ALLOW_PRAGMA;
|
401
401
|
} else {
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
402
|
+
if ((flags & GRN_EXPR_SYNTAX_SCRIPT))
|
403
|
+
rb_raise(rb_eArgError,
|
404
|
+
":allow_pragma isn't allowed in script syntax");
|
405
|
+
if (RVAL2CBOOL(rb_allow_pragma))
|
406
|
+
flags |= GRN_EXPR_ALLOW_PRAGMA;
|
407
407
|
}
|
408
408
|
|
409
409
|
if (NIL_P(rb_allow_column)) {
|
410
|
-
|
411
|
-
|
410
|
+
if (!(flags & GRN_EXPR_SYNTAX_SCRIPT))
|
411
|
+
flags |= GRN_EXPR_ALLOW_COLUMN;
|
412
412
|
} else {
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
413
|
+
if ((flags & GRN_EXPR_SYNTAX_SCRIPT))
|
414
|
+
rb_raise(rb_eArgError,
|
415
|
+
":allow_column isn't allowed in script syntax");
|
416
|
+
if (RVAL2CBOOL(rb_allow_column))
|
417
|
+
flags |= GRN_EXPR_ALLOW_COLUMN;
|
418
418
|
}
|
419
419
|
|
420
420
|
if (NIL_P(rb_allow_update)) {
|
421
|
-
|
421
|
+
flags |= GRN_EXPR_ALLOW_UPDATE;
|
422
422
|
} else {
|
423
|
-
|
424
|
-
|
423
|
+
if (RVAL2CBOOL(rb_allow_update))
|
424
|
+
flags |= GRN_EXPR_ALLOW_UPDATE;
|
425
425
|
}
|
426
426
|
|
427
427
|
if (!NIL_P(rb_allow_leading_not)) {
|
428
|
-
|
429
|
-
|
428
|
+
if (RVAL2CBOOL(rb_allow_leading_not))
|
429
|
+
flags |= GRN_EXPR_ALLOW_LEADING_NOT;
|
430
430
|
}
|
431
431
|
|
432
432
|
rc = grn_expr_parse(context, expression, query, query_size,
|
433
|
-
|
434
|
-
|
433
|
+
default_column, default_mode, default_operator,
|
434
|
+
flags);
|
435
435
|
if (rc != GRN_SUCCESS) {
|
436
|
-
|
436
|
+
VALUE related_object;
|
437
437
|
|
438
|
-
|
439
|
-
|
438
|
+
related_object = rb_ary_new3(2, self, rb_ary_new4(argc, argv));
|
439
|
+
exception = rb_grn_context_to_exception(context, related_object);
|
440
440
|
}
|
441
441
|
if (default_column_is_created)
|
442
|
-
|
442
|
+
grn_obj_unlink(context, default_column);
|
443
443
|
|
444
444
|
if (!NIL_P(exception))
|
445
|
-
|
445
|
+
rb_exc_raise(exception);
|
446
446
|
|
447
447
|
return Qnil;
|
448
448
|
}
|
@@ -564,8 +564,8 @@ rb_grn_expression_inspect (VALUE self)
|
|
564
564
|
#endif
|
565
565
|
GRN_TEXT_PUTS(context, &inspected, ">");
|
566
566
|
rb_inspected = rb_grn_context_rb_string_new(context,
|
567
|
-
|
568
|
-
|
567
|
+
GRN_TEXT_VALUE(&inspected),
|
568
|
+
GRN_TEXT_LEN(&inspected));
|
569
569
|
GRN_OBJ_FIN(context, &inspected);
|
570
570
|
|
571
571
|
return rb_inspected;
|
@@ -657,15 +657,15 @@ rb_grn_expression_snippet (int argc, VALUE *argv, VALUE self)
|
|
657
657
|
NULL);
|
658
658
|
|
659
659
|
if (TYPE(rb_tags) != T_ARRAY) {
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
660
|
+
rb_raise(rb_eArgError,
|
661
|
+
"tags should be "
|
662
|
+
"[\"open_tag\", \"close_tag\"] or "
|
663
|
+
"[[\"open_tag1\", \"close_tag1\"], ...]: %s",
|
664
|
+
rb_grn_inspect(rb_tags));
|
665
665
|
}
|
666
666
|
|
667
667
|
if (TYPE(RARRAY_PTR(rb_tags)[0]) == T_STRING) {
|
668
|
-
|
668
|
+
rb_tags = rb_ary_new3(1, rb_tags);
|
669
669
|
}
|
670
670
|
|
671
671
|
rb_tag_values = RARRAY_PTR(rb_tags);
|
@@ -675,21 +675,21 @@ rb_grn_expression_snippet (int argc, VALUE *argv, VALUE self)
|
|
675
675
|
close_tags = ALLOCA_N(char *, n_tags);
|
676
676
|
close_tag_lengths = ALLOCA_N(unsigned int, n_tags);
|
677
677
|
for (i = 0; i < n_tags; i++) {
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
678
|
+
VALUE *tag_pair;
|
679
|
+
|
680
|
+
if (TYPE(rb_tag_values[i]) != T_ARRAY ||
|
681
|
+
RARRAY_LEN(rb_tag_values[i]) != 2) {
|
682
|
+
rb_raise(rb_eArgError,
|
683
|
+
"tags should be "
|
684
|
+
"[\"open_tag\", \"close_tag\"] or"
|
685
|
+
"[[\"open_tag1\", \"close_tag1\"], ...]: %s",
|
686
|
+
rb_grn_inspect(rb_tags));
|
687
|
+
}
|
688
|
+
tag_pair = RARRAY_PTR(rb_tag_values[i]);
|
689
|
+
open_tags[i] = StringValuePtr(tag_pair[0]);
|
690
|
+
open_tag_lengths[i] = RSTRING_LEN(tag_pair[0]);
|
691
|
+
close_tags[i] = StringValuePtr(tag_pair[1]);
|
692
|
+
close_tag_lengths[i] = RSTRING_LEN(tag_pair[1]);
|
693
693
|
}
|
694
694
|
|
695
695
|
if (RVAL2CBOOL(rb_normalize))
|
@@ -707,7 +707,7 @@ rb_grn_expression_snippet (int argc, VALUE *argv, VALUE self)
|
|
707
707
|
mapping = (grn_snip_mapping *)-1;
|
708
708
|
|
709
709
|
snippet = grn_expr_snip(context, expression, flags, width, max_results,
|
710
|
-
|
710
|
+
n_tags,
|
711
711
|
(const char **)open_tags, open_tag_lengths,
|
712
712
|
(const char **)close_tags, close_tag_lengths,
|
713
713
|
mapping);
|