rroonga 3.0.5 → 3.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/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
@@ -49,15 +49,15 @@ rb_grn_context_from_ruby_object (VALUE object)
|
|
49
49
|
RbGrnContext *rb_grn_context;
|
50
50
|
|
51
51
|
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, cGrnContext))) {
|
52
|
-
|
52
|
+
rb_raise(rb_eTypeError, "not a groonga context");
|
53
53
|
}
|
54
54
|
|
55
55
|
Data_Get_Struct(object, RbGrnContext, rb_grn_context);
|
56
56
|
if (!rb_grn_context)
|
57
|
-
|
57
|
+
rb_raise(rb_eGrnError, "groonga context is NULL");
|
58
58
|
if (!rb_grn_context->context)
|
59
|
-
|
60
|
-
|
59
|
+
rb_raise(rb_eGrnClosed,
|
60
|
+
"can't access already closed groonga context");
|
61
61
|
return rb_grn_context->context;
|
62
62
|
}
|
63
63
|
|
@@ -72,12 +72,12 @@ rb_grn_context_register_floating_object (RbGrnObject *rb_grn_object)
|
|
72
72
|
context = rb_grn_context->context;
|
73
73
|
floating_objects = rb_grn_context->floating_objects;
|
74
74
|
if (!floating_objects) {
|
75
|
-
|
76
|
-
|
75
|
+
rb_grn_context_reset_floating_objects(rb_grn_context);
|
76
|
+
floating_objects = rb_grn_context->floating_objects;
|
77
77
|
}
|
78
78
|
grn_hash_add(context, floating_objects,
|
79
|
-
|
80
|
-
|
79
|
+
(const void *)(&rb_grn_object), sizeof(RbGrnObject *),
|
80
|
+
NULL, NULL);
|
81
81
|
rb_grn_object->floating = GRN_TRUE;
|
82
82
|
}
|
83
83
|
|
@@ -89,17 +89,17 @@ rb_grn_context_unregister_floating_object (RbGrnObject *rb_grn_object)
|
|
89
89
|
grn_hash *floating_objects;
|
90
90
|
|
91
91
|
if (!rb_grn_object->floating)
|
92
|
-
|
92
|
+
return;
|
93
93
|
|
94
94
|
rb_grn_context = rb_grn_object->rb_grn_context;
|
95
95
|
if (!rb_grn_context)
|
96
|
-
|
96
|
+
return;
|
97
97
|
|
98
98
|
context = rb_grn_context->context;
|
99
99
|
floating_objects = rb_grn_context->floating_objects;
|
100
100
|
grn_hash_delete(context, floating_objects,
|
101
|
-
|
102
|
-
|
101
|
+
(const void *)&rb_grn_object, sizeof(RbGrnObject *),
|
102
|
+
NULL);
|
103
103
|
rb_grn_object->floating = GRN_FALSE;
|
104
104
|
}
|
105
105
|
|
@@ -113,13 +113,13 @@ rb_grn_context_close_floating_objects (RbGrnContext *rb_grn_context)
|
|
113
113
|
context = rb_grn_context->context;
|
114
114
|
floating_objects = rb_grn_context->floating_objects;
|
115
115
|
if (!floating_objects)
|
116
|
-
|
116
|
+
return;
|
117
117
|
|
118
118
|
rb_grn_context->floating_objects = NULL;
|
119
119
|
GRN_HASH_EACH(context, floating_objects, id, &floating_object, NULL, NULL, {
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
(*floating_object)->floating = GRN_FALSE;
|
121
|
+
grn_obj_close(context, RB_GRN_OBJECT(*floating_object)->object);
|
122
|
+
});
|
123
123
|
grn_hash_close(context, floating_objects);
|
124
124
|
}
|
125
125
|
|
@@ -131,9 +131,9 @@ rb_grn_context_reset_floating_objects (RbGrnContext *rb_grn_context)
|
|
131
131
|
rb_grn_context_close_floating_objects(rb_grn_context);
|
132
132
|
context = rb_grn_context->context;
|
133
133
|
rb_grn_context->floating_objects = grn_hash_create(context, NULL,
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
sizeof(RbGrnObject *),
|
135
|
+
0,
|
136
|
+
GRN_OBJ_TABLE_HASH_KEY);
|
137
137
|
}
|
138
138
|
|
139
139
|
void
|
@@ -145,15 +145,15 @@ rb_grn_context_mark_grn_id (grn_ctx *context, grn_id id)
|
|
145
145
|
|
146
146
|
object = grn_ctx_at(context, id);
|
147
147
|
if (!object)
|
148
|
-
|
148
|
+
return;
|
149
149
|
|
150
150
|
user_data = grn_obj_user_data(context, object);
|
151
151
|
if (!user_data)
|
152
|
-
|
152
|
+
return;
|
153
153
|
|
154
154
|
rb_grn_object = RB_GRN_OBJECT(user_data->ptr);
|
155
155
|
if (!rb_grn_object)
|
156
|
-
|
156
|
+
return;
|
157
157
|
|
158
158
|
rb_gc_mark(rb_grn_object->self);
|
159
159
|
}
|
@@ -176,10 +176,10 @@ static void
|
|
176
176
|
rb_grn_context_fin (grn_ctx *context)
|
177
177
|
{
|
178
178
|
if (context->stat == GRN_CTX_FIN)
|
179
|
-
|
179
|
+
return;
|
180
180
|
|
181
181
|
if (!(context->flags & GRN_CTX_PER_DB)) {
|
182
|
-
|
182
|
+
rb_grn_context_unlink_database(context);
|
183
183
|
}
|
184
184
|
grn_ctx_fin(context);
|
185
185
|
}
|
@@ -194,7 +194,7 @@ rb_grn_context_free (void *pointer)
|
|
194
194
|
debug("context-free: %p\n", context);
|
195
195
|
rb_grn_context_close_floating_objects(rb_grn_context);
|
196
196
|
if (context && !rb_grn_exited)
|
197
|
-
|
197
|
+
rb_grn_context_fin(context);
|
198
198
|
debug("context-free: %p: done\n", context);
|
199
199
|
xfree(rb_grn_context);
|
200
200
|
}
|
@@ -207,30 +207,30 @@ rb_grn_context_alloc (VALUE klass)
|
|
207
207
|
|
208
208
|
static grn_obj *
|
209
209
|
rb_grn_context_finalizer (grn_ctx *context, int n_args, grn_obj **grn_objects,
|
210
|
-
|
210
|
+
grn_user_data *user_data)
|
211
211
|
{
|
212
212
|
RbGrnContext *rb_grn_context;
|
213
213
|
|
214
214
|
if (rb_grn_exited)
|
215
|
-
|
215
|
+
return NULL;
|
216
216
|
|
217
217
|
rb_grn_context = user_data->ptr;
|
218
218
|
|
219
219
|
rb_grn_context_close_floating_objects(rb_grn_context);
|
220
220
|
if (!(context->flags & GRN_CTX_PER_DB)) {
|
221
|
-
|
221
|
+
rb_grn_context_unlink_database(context);
|
222
222
|
}
|
223
223
|
|
224
224
|
GRN_CTX_USER_DATA(context)->ptr = NULL;
|
225
225
|
grn_ctx_set_finalizer(context, NULL);
|
226
226
|
|
227
227
|
debug("context-finalize: %p:%p:%p\n",
|
228
|
-
|
228
|
+
context, rb_grn_context, rb_grn_context->context);
|
229
229
|
|
230
230
|
rb_grn_context->context = NULL;
|
231
231
|
|
232
232
|
debug("context-finalize: %p:%p:%p: done\n",
|
233
|
-
|
233
|
+
context, rb_grn_context, rb_grn_context->context);
|
234
234
|
|
235
235
|
return NULL;
|
236
236
|
}
|
@@ -243,7 +243,7 @@ rb_grn_context_to_exception (grn_ctx *context, VALUE related_object)
|
|
243
243
|
grn_obj bulk;
|
244
244
|
|
245
245
|
if (context->rc == GRN_SUCCESS)
|
246
|
-
|
246
|
+
return Qnil;
|
247
247
|
|
248
248
|
exception_class = rb_grn_rc_to_exception(context->rc);
|
249
249
|
message = rb_grn_rc_to_message(context->rc);
|
@@ -255,8 +255,8 @@ rb_grn_context_to_exception (grn_ctx *context, VALUE related_object)
|
|
255
255
|
GRN_TEXT_PUTS(context, &bulk, context->errbuf);
|
256
256
|
}
|
257
257
|
if (!NIL_P(related_object)) {
|
258
|
-
|
259
|
-
|
258
|
+
GRN_TEXT_PUTS(context, &bulk, ": ");
|
259
|
+
GRN_TEXT_PUTS(context, &bulk, rb_grn_inspect(related_object));
|
260
260
|
}
|
261
261
|
if (context->errline > 0) {
|
262
262
|
GRN_TEXT_PUTS(context, &bulk, "\n");
|
@@ -268,8 +268,8 @@ rb_grn_context_to_exception (grn_ctx *context, VALUE related_object)
|
|
268
268
|
GRN_TEXT_PUTS(context, &bulk, "()");
|
269
269
|
}
|
270
270
|
exception = rb_funcall(exception_class, rb_intern("new"), 1,
|
271
|
-
|
272
|
-
|
271
|
+
rb_str_new(GRN_BULK_HEAD(&bulk),
|
272
|
+
GRN_BULK_VSIZE(&bulk)));
|
273
273
|
grn_obj_unlink(context, &bulk);
|
274
274
|
|
275
275
|
return exception;
|
@@ -282,7 +282,7 @@ rb_grn_context_check (grn_ctx *context, VALUE related_object)
|
|
282
282
|
|
283
283
|
exception = rb_grn_context_to_exception(context, related_object);
|
284
284
|
if (NIL_P(exception))
|
285
|
-
|
285
|
+
return;
|
286
286
|
|
287
287
|
rb_exc_raise(exception);
|
288
288
|
}
|
@@ -291,7 +291,7 @@ grn_ctx *
|
|
291
291
|
rb_grn_context_ensure (VALUE *context)
|
292
292
|
{
|
293
293
|
if (NIL_P(*context))
|
294
|
-
|
294
|
+
*context = rb_grn_context_get_default();
|
295
295
|
return SELF(*context);
|
296
296
|
}
|
297
297
|
|
@@ -299,10 +299,10 @@ VALUE
|
|
299
299
|
rb_grn_context_rb_string_new (grn_ctx *context, const char *string, long length)
|
300
300
|
{
|
301
301
|
if (length < 0)
|
302
|
-
|
302
|
+
length = strlen(string);
|
303
303
|
#ifdef HAVE_RUBY_ENCODING_H
|
304
304
|
return rb_enc_str_new(string, length,
|
305
|
-
|
305
|
+
rb_grn_encoding_to_ruby_encoding(context->encoding));
|
306
306
|
#else
|
307
307
|
return rb_str_new(string, length);
|
308
308
|
#endif
|
@@ -318,25 +318,25 @@ rb_grn_context_rb_string_encode (grn_ctx *context, VALUE rb_string)
|
|
318
318
|
|
319
319
|
context_encoding = context->encoding;
|
320
320
|
if (context->encoding == GRN_ENC_DEFAULT)
|
321
|
-
|
321
|
+
context->encoding = grn_get_default_encoding();
|
322
322
|
if (context->encoding == GRN_ENC_NONE)
|
323
|
-
|
323
|
+
return rb_string;
|
324
324
|
|
325
325
|
if (RSTRING_LEN(rb_string) < 0)
|
326
|
-
|
326
|
+
return rb_string;
|
327
327
|
|
328
328
|
encoding = rb_enc_get(rb_string);
|
329
329
|
to_encoding = rb_grn_encoding_to_ruby_encoding(context_encoding);
|
330
330
|
index = rb_enc_to_index(encoding);
|
331
331
|
to_index = rb_enc_to_index(to_encoding);
|
332
332
|
if (index == to_index)
|
333
|
-
|
333
|
+
return rb_string;
|
334
334
|
|
335
335
|
if (rb_enc_asciicompat(to_encoding) && rb_enc_str_asciionly_p(rb_string))
|
336
|
-
|
336
|
+
return rb_string;
|
337
337
|
|
338
338
|
rb_string = rb_str_encode(rb_string, rb_enc_from_encoding(to_encoding),
|
339
|
-
|
339
|
+
0, Qnil);
|
340
340
|
#endif
|
341
341
|
return rb_string;
|
342
342
|
}
|
@@ -366,8 +366,8 @@ rb_grn_context_s_get_default (VALUE self)
|
|
366
366
|
|
367
367
|
context = rb_cv_get(self, "@@default");
|
368
368
|
if (NIL_P(context)) {
|
369
|
-
|
370
|
-
|
369
|
+
context = rb_funcall(cGrnContext, rb_intern("new"), 0);
|
370
|
+
rb_cv_set(self, "@@default", context);
|
371
371
|
}
|
372
372
|
return context;
|
373
373
|
}
|
@@ -441,15 +441,15 @@ rb_grn_context_initialize (int argc, VALUE *argv, VALUE self)
|
|
441
441
|
rb_scan_args(argc, argv, "01", &options);
|
442
442
|
default_options = rb_grn_context_s_get_default_options(rb_obj_class(self));
|
443
443
|
if (NIL_P(default_options))
|
444
|
-
|
444
|
+
default_options = rb_hash_new();
|
445
445
|
|
446
446
|
if (NIL_P(options))
|
447
|
-
|
447
|
+
options = rb_hash_new();
|
448
448
|
options = rb_funcall(default_options, rb_intern("merge"), 1, options);
|
449
449
|
|
450
450
|
rb_grn_scan_options(options,
|
451
|
-
|
452
|
-
|
451
|
+
"encoding", &rb_encoding,
|
452
|
+
NULL);
|
453
453
|
|
454
454
|
rb_grn_context = ALLOC(RbGrnContext);
|
455
455
|
DATA_PTR(self) = rb_grn_context;
|
@@ -464,10 +464,10 @@ rb_grn_context_initialize (int argc, VALUE *argv, VALUE self)
|
|
464
464
|
grn_ctx_set_finalizer(context, rb_grn_context_finalizer);
|
465
465
|
|
466
466
|
if (!NIL_P(rb_encoding)) {
|
467
|
-
|
467
|
+
grn_encoding encoding;
|
468
468
|
|
469
|
-
|
470
|
-
|
469
|
+
encoding = RVAL2GRNENCODING(rb_encoding, NULL);
|
470
|
+
GRN_CTX_SET_ENCODING(context, encoding);
|
471
471
|
}
|
472
472
|
|
473
473
|
rb_iv_set(self, "@memory_pools", rb_ary_new());
|
@@ -492,10 +492,10 @@ rb_grn_context_close (VALUE self)
|
|
492
492
|
|
493
493
|
context = SELF(self);
|
494
494
|
if (context) {
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
495
|
+
rc = grn_ctx_fin(context);
|
496
|
+
Data_Get_Struct(self, RbGrnContext, rb_grn_context);
|
497
|
+
rb_grn_context->context = NULL;
|
498
|
+
rb_grn_rc_check(rc, self);
|
499
499
|
}
|
500
500
|
|
501
501
|
return Qnil;
|
@@ -727,22 +727,22 @@ rb_grn_context_connect (int argc, VALUE *argv, VALUE self)
|
|
727
727
|
|
728
728
|
rb_scan_args(argc, argv, "01", &options);
|
729
729
|
rb_grn_scan_options(options,
|
730
|
-
|
731
|
-
|
732
|
-
|
730
|
+
"host", &rb_host,
|
731
|
+
"port", &rb_port,
|
732
|
+
NULL);
|
733
733
|
|
734
734
|
context = SELF(self);
|
735
735
|
|
736
736
|
if (NIL_P(rb_host)) {
|
737
|
-
|
737
|
+
host = "localhost";
|
738
738
|
} else {
|
739
|
-
|
739
|
+
host = StringValueCStr(rb_host);
|
740
740
|
}
|
741
741
|
|
742
742
|
if (NIL_P(rb_port)) {
|
743
|
-
|
743
|
+
port = 10041;
|
744
744
|
} else {
|
745
|
-
|
745
|
+
port = NUM2INT(rb_port);
|
746
746
|
}
|
747
747
|
|
748
748
|
rc = grn_ctx_connect(context, host, port, flags);
|
@@ -794,9 +794,9 @@ rb_grn_context_receive (VALUE self)
|
|
794
794
|
context = SELF(self);
|
795
795
|
query_id = grn_ctx_recv(context, &result, &result_size, &flags);
|
796
796
|
if (result) {
|
797
|
-
|
797
|
+
rb_result = rb_str_new(result, result_size);
|
798
798
|
} else {
|
799
|
-
|
799
|
+
rb_result = Qnil;
|
800
800
|
}
|
801
801
|
rb_grn_context_check(context, self);
|
802
802
|
|
@@ -809,38 +809,38 @@ grn_type_name_old_to_new (const char *name, unsigned int name_size)
|
|
809
809
|
unsigned int i;
|
810
810
|
|
811
811
|
for (i = 0; i < name_size; i++) {
|
812
|
-
|
813
|
-
|
812
|
+
if (name[i] == '\0')
|
813
|
+
return NULL;
|
814
814
|
}
|
815
815
|
|
816
816
|
if (strcmp(name, "<int>") == 0) {
|
817
|
-
|
817
|
+
return "Int32";
|
818
818
|
} else if (strcmp(name, "<uint>") == 0) {
|
819
|
-
|
819
|
+
return "UInt32";
|
820
820
|
} else if (strcmp(name, "<int64>") == 0) {
|
821
|
-
|
821
|
+
return "Int64";
|
822
822
|
} else if (strcmp(name, "<uint64>") == 0) {
|
823
|
-
|
823
|
+
return "UInt64";
|
824
824
|
} else if (strcmp(name, "<float>") == 0) {
|
825
|
-
|
825
|
+
return "Float";
|
826
826
|
} else if (strcmp(name, "<time>") == 0) {
|
827
|
-
|
827
|
+
return "Time";
|
828
828
|
} else if (strcmp(name, "<shorttext>") == 0) {
|
829
|
-
|
829
|
+
return "ShortText";
|
830
830
|
} else if (strcmp(name, "<text>") == 0) {
|
831
|
-
|
831
|
+
return "Text";
|
832
832
|
} else if (strcmp(name, "<longtext>") == 0) {
|
833
|
-
|
833
|
+
return "LongText";
|
834
834
|
} else if (strcmp(name, "<token:delimit>") == 0) {
|
835
|
-
|
835
|
+
return "TokenDelimit";
|
836
836
|
} else if (strcmp(name, "<token:unigram>") == 0) {
|
837
|
-
|
837
|
+
return "TokenUnigram";
|
838
838
|
} else if (strcmp(name, "<token:bigram>") == 0) {
|
839
|
-
|
839
|
+
return "TokenBigram";
|
840
840
|
} else if (strcmp(name, "<token:trigram>") == 0) {
|
841
|
-
|
841
|
+
return "TokenTrigram";
|
842
842
|
} else if (strcmp(name, "<token:mecab>") == 0) {
|
843
|
-
|
843
|
+
return "TokenMecab";
|
844
844
|
}
|
845
845
|
|
846
846
|
return NULL;
|
@@ -848,26 +848,26 @@ grn_type_name_old_to_new (const char *name, unsigned int name_size)
|
|
848
848
|
|
849
849
|
grn_obj *
|
850
850
|
rb_grn_context_get_backward_compatibility (grn_ctx *context,
|
851
|
-
|
852
|
-
|
851
|
+
const char *name,
|
852
|
+
unsigned int name_size)
|
853
853
|
{
|
854
854
|
grn_obj *object;
|
855
855
|
|
856
856
|
object = grn_ctx_get(context, name, name_size);
|
857
857
|
if (!object) {
|
858
|
-
|
858
|
+
const char *new_type_name;
|
859
859
|
|
860
|
-
|
861
|
-
|
862
|
-
|
860
|
+
new_type_name = grn_type_name_old_to_new(name, name_size);
|
861
|
+
if (new_type_name) {
|
862
|
+
object = grn_ctx_get(context, new_type_name, strlen(new_type_name));
|
863
863
|
#if 0
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
864
|
+
if (object) {
|
865
|
+
rb_warn("deprecated old data type name <%s> is used. "
|
866
|
+
"Use new data type name <%s> instead.",
|
867
|
+
name, new_type_name);
|
868
|
+
}
|
869
869
|
#endif
|
870
|
-
|
870
|
+
}
|
871
871
|
}
|
872
872
|
|
873
873
|
return object;
|
@@ -900,26 +900,26 @@ rb_grn_context_array_reference (VALUE self, VALUE name_or_id)
|
|
900
900
|
context = SELF(self);
|
901
901
|
switch (TYPE(name_or_id)) {
|
902
902
|
case T_SYMBOL:
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
903
|
+
name = rb_id2name(SYM2ID(name_or_id));
|
904
|
+
name_size = strlen(name);
|
905
|
+
object = rb_grn_context_get_backward_compatibility(context,
|
906
|
+
name, name_size);
|
907
|
+
break;
|
908
908
|
case T_STRING:
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
909
|
+
name = StringValuePtr(name_or_id);
|
910
|
+
name_size = RSTRING_LEN(name_or_id);
|
911
|
+
object = rb_grn_context_get_backward_compatibility(context,
|
912
|
+
name, name_size);
|
913
|
+
break;
|
914
914
|
case T_FIXNUM:
|
915
|
-
|
916
|
-
|
917
|
-
|
915
|
+
id = NUM2UINT(name_or_id);
|
916
|
+
object = grn_ctx_at(context, id);
|
917
|
+
break;
|
918
918
|
default:
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
919
|
+
rb_raise(rb_eArgError,
|
920
|
+
"should be String, Symbol or unsigned integer: %s",
|
921
|
+
rb_grn_inspect(name_or_id));
|
922
|
+
break;
|
923
923
|
}
|
924
924
|
rb_grn_context_check(context, name_or_id);
|
925
925
|
|
@@ -944,13 +944,13 @@ rb_grn_init_context (VALUE mGrn)
|
|
944
944
|
rb_cv_set(cGrnContext, "@@default_options", Qnil);
|
945
945
|
|
946
946
|
rb_define_singleton_method(cGrnContext, "default",
|
947
|
-
|
947
|
+
rb_grn_context_s_get_default, 0);
|
948
948
|
rb_define_singleton_method(cGrnContext, "default=",
|
949
|
-
|
949
|
+
rb_grn_context_s_set_default, 1);
|
950
950
|
rb_define_singleton_method(cGrnContext, "default_options",
|
951
|
-
|
951
|
+
rb_grn_context_s_get_default_options, 0);
|
952
952
|
rb_define_singleton_method(cGrnContext, "default_options=",
|
953
|
-
|
953
|
+
rb_grn_context_s_set_default_options, 1);
|
954
954
|
|
955
955
|
rb_define_method(cGrnContext, "initialize", rb_grn_context_initialize, -1);
|
956
956
|
|
@@ -962,16 +962,16 @@ rb_grn_init_context (VALUE mGrn)
|
|
962
962
|
rb_define_method(cGrnContext, "encoding", rb_grn_context_get_encoding, 0);
|
963
963
|
rb_define_method(cGrnContext, "encoding=", rb_grn_context_set_encoding, 1);
|
964
964
|
rb_define_method(cGrnContext, "ruby_encoding",
|
965
|
-
|
965
|
+
rb_grn_context_get_ruby_encoding, 0);
|
966
966
|
rb_define_method(cGrnContext, "match_escalation_threshold",
|
967
|
-
|
967
|
+
rb_grn_context_get_match_escalation_threshold, 0);
|
968
968
|
rb_define_method(cGrnContext, "match_escalation_threshold=",
|
969
|
-
|
969
|
+
rb_grn_context_set_match_escalation_threshold, 1);
|
970
970
|
|
971
971
|
rb_define_method(cGrnContext, "support_zlib?",
|
972
|
-
|
972
|
+
rb_grn_context_support_zlib_p, 0);
|
973
973
|
rb_define_method(cGrnContext, "support_lzo?",
|
974
|
-
|
974
|
+
rb_grn_context_support_lzo_p, 0);
|
975
975
|
|
976
976
|
rb_define_method(cGrnContext, "database", rb_grn_context_get_database, 0);
|
977
977
|
|