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.
Files changed (49) hide show
  1. data/AUTHORS +5 -0
  2. data/Gemfile +20 -0
  3. data/Rakefile +187 -0
  4. data/doc/text/news.textile +7 -0
  5. data/doc/text/tutorial.textile +0 -2
  6. data/ext/groonga/extconf.rb +7 -1
  7. data/ext/groonga/rb-grn-accessor.c +11 -11
  8. data/ext/groonga/rb-grn-array.c +25 -25
  9. data/ext/groonga/rb-grn-column.c +106 -106
  10. data/ext/groonga/rb-grn-context.c +121 -121
  11. data/ext/groonga/rb-grn-database.c +78 -78
  12. data/ext/groonga/rb-grn-double-array-trie.c +92 -92
  13. data/ext/groonga/rb-grn-encoding-support.c +1 -1
  14. data/ext/groonga/rb-grn-encoding.c +28 -28
  15. data/ext/groonga/rb-grn-exception.c +9 -9
  16. data/ext/groonga/rb-grn-expression-builder.c +6 -6
  17. data/ext/groonga/rb-grn-expression.c +87 -87
  18. data/ext/groonga/rb-grn-fix-size-column.c +12 -12
  19. data/ext/groonga/rb-grn-geo-point.c +2 -2
  20. data/ext/groonga/rb-grn-hash.c +38 -38
  21. data/ext/groonga/rb-grn-index-column.c +191 -191
  22. data/ext/groonga/rb-grn-index-cursor.c +29 -29
  23. data/ext/groonga/rb-grn-logger.c +36 -36
  24. data/ext/groonga/rb-grn-normalizer.c +10 -10
  25. data/ext/groonga/rb-grn-patricia-trie.c +196 -196
  26. data/ext/groonga/rb-grn-plugin.c +5 -5
  27. data/ext/groonga/rb-grn-posting.c +2 -2
  28. data/ext/groonga/rb-grn-procedure.c +2 -2
  29. data/ext/groonga/rb-grn-query-logger.c +1 -1
  30. data/ext/groonga/rb-grn-record.c +1 -1
  31. data/ext/groonga/rb-grn-snippet.c +14 -14
  32. data/ext/groonga/rb-grn-table-cursor-key-support.c +4 -4
  33. data/ext/groonga/rb-grn-table-cursor.c +52 -52
  34. data/ext/groonga/rb-grn-table-key-support.c +209 -209
  35. data/ext/groonga/rb-grn-type.c +18 -18
  36. data/ext/groonga/rb-grn-utils.c +332 -314
  37. data/ext/groonga/rb-grn-variable-size-column.c +34 -34
  38. data/ext/groonga/rb-grn-variable.c +2 -2
  39. data/ext/groonga/rb-grn.h +240 -232
  40. data/ext/groonga/rb-groonga.c +10 -10
  41. data/lib/1.9/groonga.so +0 -0
  42. data/lib/2.0/groonga.so +0 -0
  43. data/rroonga-build.rb +7 -0
  44. data/rroonga.gemspec +1 -1
  45. data/test/test-hash.rb +4 -4
  46. data/test/test-index-column.rb +271 -257
  47. data/test/test-table-key-support.rb +78 -0
  48. data/test/test-table.rb +78 -51
  49. metadata +8 -3
@@ -37,7 +37,7 @@ grn_obj *
37
37
  rb_grn_database_from_ruby_object (VALUE object)
38
38
  {
39
39
  if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnDatabase))) {
40
- rb_raise(rb_eTypeError, "not a groonga database");
40
+ rb_raise(rb_eTypeError, "not a groonga database");
41
41
  }
42
42
 
43
43
  return RVAL2GRNOBJECT(object, NULL);
@@ -45,7 +45,7 @@ rb_grn_database_from_ruby_object (VALUE object)
45
45
 
46
46
  VALUE
47
47
  rb_grn_database_to_ruby_object (grn_ctx *context, grn_obj *database,
48
- grn_bool owner)
48
+ grn_bool owner)
49
49
  {
50
50
  return GRNOBJECT2RVAL(rb_cGrnDatabase, context, database, owner);
51
51
  }
@@ -57,12 +57,12 @@ rb_grn_database_mark_existing_ruby_object (grn_ctx *context, grn_obj *database)
57
57
  grn_id id;
58
58
 
59
59
  cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
60
- 0, -1, GRN_CURSOR_ASCENDING);
60
+ 0, -1, GRN_CURSOR_ASCENDING);
61
61
  if (!cursor)
62
- return;
62
+ return;
63
63
 
64
64
  while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
65
- rb_grn_context_mark_grn_id(context, id);
65
+ rb_grn_context_mark_grn_id(context, id);
66
66
  }
67
67
  grn_table_cursor_close(context, cursor);
68
68
  }
@@ -75,12 +75,12 @@ rb_grn_database_mark (void *data)
75
75
  grn_obj *database;
76
76
 
77
77
  if (!rb_grn_database)
78
- return;
78
+ return;
79
79
 
80
80
  context = rb_grn_database->context;
81
81
  database = rb_grn_database->object;
82
82
  if (!context || !database)
83
- return;
83
+ return;
84
84
 
85
85
  rb_grn_database_mark_existing_ruby_object(context, database);
86
86
  }
@@ -89,35 +89,35 @@ static VALUE
89
89
  rb_grn_database_alloc (VALUE klass)
90
90
  {
91
91
  return Data_Wrap_Struct(klass, rb_grn_database_mark, rb_grn_object_free,
92
- NULL);
92
+ NULL);
93
93
  }
94
94
 
95
95
  static void
96
96
  rb_grn_database_deconstruct (RbGrnObject *rb_grn_database,
97
- grn_obj **database,
98
- grn_ctx **context,
99
- grn_id *domain_id,
100
- grn_obj **domain,
101
- grn_id *range_id,
102
- grn_obj **range)
97
+ grn_obj **database,
98
+ grn_ctx **context,
99
+ grn_id *domain_id,
100
+ grn_obj **domain,
101
+ grn_id *range_id,
102
+ grn_obj **range)
103
103
  {
104
104
  rb_grn_object_deconstruct(rb_grn_database, database, context,
105
- domain_id, domain,
106
- range_id, range);
105
+ domain_id, domain,
106
+ range_id, range);
107
107
  }
108
108
 
109
109
  void
110
110
  rb_grn_database_finalizer (grn_ctx *context,
111
- RbGrnContext *rb_grn_context,
112
- grn_obj *column,
113
- RbGrnObject *rb_grn_database)
111
+ RbGrnContext *rb_grn_context,
112
+ grn_obj *column,
113
+ RbGrnObject *rb_grn_database)
114
114
  {
115
115
  if (rb_grn_context) {
116
- rb_grn_context_close_floating_objects(rb_grn_context);
116
+ rb_grn_context_close_floating_objects(rb_grn_context);
117
117
  }
118
118
 
119
119
  if (!(context->flags & GRN_CTX_PER_DB)) {
120
- grn_ctx_use(context, NULL);
120
+ grn_ctx_use(context, NULL);
121
121
  }
122
122
  }
123
123
 
@@ -134,7 +134,7 @@ rb_grn_database_close (VALUE self)
134
134
 
135
135
  rb_context = rb_iv_get(self, "@context");
136
136
  if (!NIL_P(rb_context))
137
- rb_iv_set(rb_context, "database", Qnil);
137
+ rb_iv_set(rb_context, "database", Qnil);
138
138
 
139
139
  return rb_grn_object_close(self);
140
140
  }
@@ -184,9 +184,9 @@ rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass)
184
184
 
185
185
  rb_grn_scan_options(options,
186
186
  "path", &rb_path,
187
- "context", &rb_context,
187
+ "context", &rb_context,
188
188
  "builtin_type_names", &builtin_type_names,
189
- NULL);
189
+ NULL);
190
190
 
191
191
  if (!NIL_P(rb_path))
192
192
  path = StringValuePtr(rb_path);
@@ -197,7 +197,7 @@ rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass)
197
197
 
198
198
  old_database = grn_ctx_db(context);
199
199
  if (old_database)
200
- grn_obj_unlink(context, old_database);
200
+ grn_obj_unlink(context, old_database);
201
201
  reset_floating_objects(rb_context);
202
202
  database = grn_db_create(context, path, &create_args);
203
203
  rb_grn_context_check(context, rb_ary_new4(argc, argv));
@@ -205,12 +205,12 @@ rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass)
205
205
  rb_database = GRNOBJECT2RVAL(klass, context, database, owner);
206
206
  rb_iv_set(rb_database, "@context", rb_context);
207
207
  if (!NIL_P(rb_context))
208
- rb_iv_set(rb_context, "database", rb_database);
208
+ rb_iv_set(rb_context, "database", rb_database);
209
209
  rb_grn_context_check(context, rb_ary_new4(argc, argv));
210
210
 
211
211
  if (rb_block_given_p())
212
212
  return rb_ensure(rb_yield, rb_database,
213
- rb_grn_database_close, rb_database);
213
+ rb_grn_database_close, rb_database);
214
214
  else
215
215
  return rb_database;
216
216
  }
@@ -246,14 +246,14 @@ rb_grn_database_initialize (int argc, VALUE *argv, VALUE self)
246
246
 
247
247
  path = StringValuePtr(rb_path);
248
248
  rb_grn_scan_options(options,
249
- "context", &rb_context,
250
- NULL);
249
+ "context", &rb_context,
250
+ NULL);
251
251
 
252
252
  context = rb_grn_context_ensure(&rb_context);
253
253
 
254
254
  old_database = grn_ctx_db(context);
255
255
  if (old_database)
256
- grn_obj_unlink(context, old_database);
256
+ grn_obj_unlink(context, old_database);
257
257
  reset_floating_objects(rb_context);
258
258
  database = grn_db_open(context, path);
259
259
  rb_grn_object_assign(Qnil, self, rb_context, context, database);
@@ -261,7 +261,7 @@ rb_grn_database_initialize (int argc, VALUE *argv, VALUE self)
261
261
 
262
262
  rb_iv_set(self, "@context", rb_context);
263
263
  if (!NIL_P(rb_context))
264
- rb_iv_set(rb_context, "database", self);
264
+ rb_iv_set(rb_context, "database", self);
265
265
 
266
266
  return Qnil;
267
267
  }
@@ -355,45 +355,45 @@ rb_grn_database_each (int argc, VALUE *argv, VALUE self)
355
355
  RETURN_ENUMERATOR(self, argc, argv);
356
356
 
357
357
  rb_grn_database_deconstruct(SELF(self), &database, &context,
358
- NULL, NULL, NULL, NULL);
358
+ NULL, NULL, NULL, NULL);
359
359
 
360
360
  rb_scan_args(argc, argv, "01", &rb_options);
361
361
 
362
362
  rb_grn_scan_options(rb_options,
363
- "order", &rb_order,
364
- "order_by", &rb_order_by,
365
- "ignore_missing_object", &rb_ignore_missing_object,
366
- NULL);
363
+ "order", &rb_order,
364
+ "order_by", &rb_order_by,
365
+ "ignore_missing_object", &rb_ignore_missing_object,
366
+ NULL);
367
367
 
368
368
  flags |= rb_grn_table_cursor_order_to_flag(rb_order);
369
369
  flags |= rb_grn_table_cursor_order_by_to_flag(GRN_TABLE_PAT_KEY,
370
- self,
371
- rb_order_by);
370
+ self,
371
+ rb_order_by);
372
372
 
373
373
  cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
374
- 0, -1,
375
- flags);
374
+ 0, -1,
375
+ flags);
376
376
  rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
377
377
  rb_iv_set(self, "cursor", rb_cursor);
378
378
  while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
379
- grn_obj *object;
380
-
381
- object = grn_ctx_at(context, id);
382
- if (!object && RTEST(rb_ignore_missing_object)) {
383
- context->rc = GRN_SUCCESS;
384
- continue;
385
- }
386
-
387
- exception = rb_grn_context_to_exception(context, self);
388
- if (!NIL_P(exception)) {
389
- rb_grn_object_close(rb_cursor);
390
- rb_iv_set(self, "cursor", Qnil);
391
- rb_exc_raise(exception);
392
- }
393
-
394
- if (object) {
395
- rb_yield(GRNOBJECT2RVAL(Qnil, context, object, GRN_FALSE));
396
- }
379
+ grn_obj *object;
380
+
381
+ object = grn_ctx_at(context, id);
382
+ if (!object && RTEST(rb_ignore_missing_object)) {
383
+ context->rc = GRN_SUCCESS;
384
+ continue;
385
+ }
386
+
387
+ exception = rb_grn_context_to_exception(context, self);
388
+ if (!NIL_P(exception)) {
389
+ rb_grn_object_close(rb_cursor);
390
+ rb_iv_set(self, "cursor", Qnil);
391
+ rb_exc_raise(exception);
392
+ }
393
+
394
+ if (object) {
395
+ rb_yield(GRNOBJECT2RVAL(Qnil, context, object, GRN_FALSE));
396
+ }
397
397
  }
398
398
  rb_grn_object_close(rb_cursor);
399
399
  rb_iv_set(self, "cursor", Qnil);
@@ -414,7 +414,7 @@ rb_grn_database_unlock (VALUE self)
414
414
  grn_rc rc;
415
415
 
416
416
  rb_grn_database_deconstruct(SELF(self), &database, &context,
417
- NULL, NULL, NULL, NULL);
417
+ NULL, NULL, NULL, NULL);
418
418
 
419
419
  rc = grn_obj_unlock(context, database, GRN_ID_NIL);
420
420
  rb_grn_context_check(context, self);
@@ -451,23 +451,23 @@ rb_grn_database_lock (int argc, VALUE *argv, VALUE self)
451
451
  rb_scan_args(argc, argv, "01", &options);
452
452
 
453
453
  rb_grn_database_deconstruct(SELF(self), &database, &context,
454
- NULL, NULL, NULL, NULL);
454
+ NULL, NULL, NULL, NULL);
455
455
 
456
456
  rb_grn_scan_options(options,
457
- "timeout", &rb_timeout,
458
- NULL);
457
+ "timeout", &rb_timeout,
458
+ NULL);
459
459
 
460
460
  if (!NIL_P(rb_timeout))
461
- timeout = NUM2UINT(rb_timeout);
461
+ timeout = NUM2UINT(rb_timeout);
462
462
 
463
463
  rc = grn_obj_lock(context, database, GRN_ID_NIL, timeout);
464
464
  rb_grn_context_check(context, self);
465
465
  rb_grn_rc_check(rc, self);
466
466
 
467
467
  if (rb_block_given_p()) {
468
- return rb_ensure(rb_yield, Qnil, rb_grn_database_unlock, self);
468
+ return rb_ensure(rb_yield, Qnil, rb_grn_database_unlock, self);
469
469
  } else {
470
- return Qnil;
470
+ return Qnil;
471
471
  }
472
472
  }
473
473
 
@@ -483,7 +483,7 @@ rb_grn_database_clear_lock (VALUE self)
483
483
  grn_obj *database;
484
484
 
485
485
  rb_grn_database_deconstruct(SELF(self), &database, &context,
486
- NULL, NULL, NULL, NULL);
486
+ NULL, NULL, NULL, NULL);
487
487
 
488
488
  grn_obj_clear_lock(context, database);
489
489
 
@@ -502,7 +502,7 @@ rb_grn_database_is_locked (VALUE self)
502
502
  grn_obj *database;
503
503
 
504
504
  rb_grn_database_deconstruct(SELF(self), &database, &context,
505
- NULL, NULL, NULL, NULL);
505
+ NULL, NULL, NULL, NULL);
506
506
 
507
507
  return CBOOL2RVAL(grn_obj_is_locked(context, database));
508
508
  }
@@ -519,7 +519,7 @@ rb_grn_database_touch (VALUE self)
519
519
  grn_obj *database;
520
520
 
521
521
  rb_grn_database_deconstruct(SELF(self), &database, &context,
522
- NULL, NULL, NULL, NULL);
522
+ NULL, NULL, NULL, NULL);
523
523
 
524
524
  grn_db_touch(context, database);
525
525
  return Qnil;
@@ -548,14 +548,14 @@ rb_grn_database_defrag (int argc, VALUE *argv, VALUE self)
548
548
 
549
549
  rb_scan_args(argc, argv, "01", &options);
550
550
  rb_grn_scan_options(options,
551
- "threshold", &rb_threshold,
552
- NULL);
551
+ "threshold", &rb_threshold,
552
+ NULL);
553
553
  if (!NIL_P(rb_threshold)) {
554
- threshold = NUM2INT(rb_threshold);
554
+ threshold = NUM2INT(rb_threshold);
555
555
  }
556
556
 
557
557
  rb_grn_database_deconstruct(SELF(self), &database, &context,
558
- NULL, NULL, NULL, NULL);
558
+ NULL, NULL, NULL, NULL);
559
559
  n_segments = grn_obj_defrag(context, database, threshold);
560
560
  rb_grn_context_check(context, self);
561
561
 
@@ -572,23 +572,23 @@ rb_grn_init_database (VALUE mGrn)
572
572
  rb_include_module(rb_cGrnDatabase, rb_mGrnEncodingSupport);
573
573
 
574
574
  rb_define_singleton_method(rb_cGrnDatabase, "create",
575
- rb_grn_database_s_create, -1);
575
+ rb_grn_database_s_create, -1);
576
576
  rb_define_singleton_method(rb_cGrnDatabase, "open",
577
- rb_grn_database_s_open, -1);
577
+ rb_grn_database_s_open, -1);
578
578
 
579
579
  rb_define_method(rb_cGrnDatabase, "initialize",
580
- rb_grn_database_initialize, -1);
580
+ rb_grn_database_initialize, -1);
581
581
 
582
582
  rb_define_method(rb_cGrnDatabase, "each",
583
- rb_grn_database_each, -1);
583
+ rb_grn_database_each, -1);
584
584
 
585
585
  rb_define_method(rb_cGrnDatabase, "close",
586
- rb_grn_database_close, 0);
586
+ rb_grn_database_close, 0);
587
587
 
588
588
  rb_define_method(rb_cGrnDatabase, "lock", rb_grn_database_lock, -1);
589
589
  rb_define_method(rb_cGrnDatabase, "unlock", rb_grn_database_unlock, 0);
590
590
  rb_define_method(rb_cGrnDatabase, "clear_lock",
591
- rb_grn_database_clear_lock, 0);
591
+ rb_grn_database_clear_lock, 0);
592
592
  rb_define_method(rb_cGrnDatabase, "locked?", rb_grn_database_is_locked, 0);
593
593
 
594
594
  rb_define_method(rb_cGrnDatabase, "touch", rb_grn_database_touch, 0);
@@ -183,66 +183,66 @@ rb_grn_double_array_trie_s_create (int argc, VALUE *argv, VALUE klass)
183
183
  rb_scan_args(argc, argv, "01", &options);
184
184
 
185
185
  rb_grn_scan_options(options,
186
- "context", &rb_context,
187
- "name", &rb_name,
186
+ "context", &rb_context,
187
+ "name", &rb_name,
188
188
  "path", &rb_path,
189
- "persistent", &rb_persistent,
190
- "key_normalize", &rb_key_normalize,
191
- "key_with_sis", &rb_key_with_sis,
192
- "key_type", &rb_key_type,
193
- "value_type", &rb_value_type,
194
- "default_tokenizer", &rb_default_tokenizer,
195
- "sub_records", &rb_sub_records,
196
- "normalizer", &rb_normalizer,
197
- NULL);
189
+ "persistent", &rb_persistent,
190
+ "key_normalize", &rb_key_normalize,
191
+ "key_with_sis", &rb_key_with_sis,
192
+ "key_type", &rb_key_type,
193
+ "value_type", &rb_value_type,
194
+ "default_tokenizer", &rb_default_tokenizer,
195
+ "sub_records", &rb_sub_records,
196
+ "normalizer", &rb_normalizer,
197
+ NULL);
198
198
 
199
199
  context = rb_grn_context_ensure(&rb_context);
200
200
 
201
201
  if (!NIL_P(rb_name)) {
202
202
  name = StringValuePtr(rb_name);
203
- name_size = RSTRING_LEN(rb_name);
204
- flags |= GRN_OBJ_PERSISTENT;
203
+ name_size = RSTRING_LEN(rb_name);
204
+ flags |= GRN_OBJ_PERSISTENT;
205
205
  }
206
206
 
207
207
  if (!NIL_P(rb_path)) {
208
208
  path = StringValueCStr(rb_path);
209
- flags |= GRN_OBJ_PERSISTENT;
209
+ flags |= GRN_OBJ_PERSISTENT;
210
210
  }
211
211
 
212
212
  if (RVAL2CBOOL(rb_persistent))
213
- flags |= GRN_OBJ_PERSISTENT;
213
+ flags |= GRN_OBJ_PERSISTENT;
214
214
 
215
215
  if (RVAL2CBOOL(rb_key_normalize))
216
- flags |= GRN_OBJ_KEY_NORMALIZE;
216
+ flags |= GRN_OBJ_KEY_NORMALIZE;
217
217
 
218
218
  if (RVAL2CBOOL(rb_key_with_sis))
219
- flags |= GRN_OBJ_KEY_WITH_SIS;
219
+ flags |= GRN_OBJ_KEY_WITH_SIS;
220
220
 
221
221
  if (NIL_P(rb_key_type)) {
222
- key_type = grn_ctx_at(context, GRN_DB_SHORT_TEXT);
222
+ key_type = grn_ctx_at(context, GRN_DB_SHORT_TEXT);
223
223
  } else {
224
- key_type = RVAL2GRNOBJECT(rb_key_type, &context);
224
+ key_type = RVAL2GRNOBJECT(rb_key_type, &context);
225
225
  }
226
226
 
227
227
  if (!NIL_P(rb_value_type))
228
- value_type = RVAL2GRNOBJECT(rb_value_type, &context);
228
+ value_type = RVAL2GRNOBJECT(rb_value_type, &context);
229
229
 
230
230
  if (RVAL2CBOOL(rb_sub_records))
231
- flags |= GRN_OBJ_WITH_SUBREC;
231
+ flags |= GRN_OBJ_WITH_SUBREC;
232
232
 
233
233
  table = grn_table_create(context, name, name_size, path,
234
- flags, key_type, value_type);
234
+ flags, key_type, value_type);
235
235
  if (!table)
236
- rb_grn_context_check(context, rb_ary_new4(argc, argv));
236
+ rb_grn_context_check(context, rb_ary_new4(argc, argv));
237
237
  rb_table = GRNOBJECT2RVAL(klass, context, table, GRN_TRUE);
238
238
 
239
239
  if (!NIL_P(rb_default_tokenizer))
240
- rb_funcall(rb_table, rb_intern("default_tokenizer="), 1,
241
- rb_default_tokenizer);
240
+ rb_funcall(rb_table, rb_intern("default_tokenizer="), 1,
241
+ rb_default_tokenizer);
242
242
 
243
243
  if (!NIL_P(rb_normalizer))
244
- rb_funcall(rb_table, rb_intern("normalizer="), 1,
245
- rb_normalizer);
244
+ rb_funcall(rb_table, rb_intern("normalizer="), 1,
245
+ rb_normalizer);
246
246
 
247
247
  if (rb_block_given_p())
248
248
  return rb_ensure(rb_yield, rb_table, rb_grn_object_close, rb_table);
@@ -308,35 +308,35 @@ rb_grn_double_array_trie_search (int argc, VALUE *argv, VALUE self)
308
308
  VALUE rb_key, options, rb_result, rb_operator, rb_type;
309
309
 
310
310
  rb_grn_table_key_support_deconstruct(SELF(self), &table, &context,
311
- &key, &domain_id, &domain,
312
- NULL, NULL, NULL,
313
- NULL);
311
+ &key, &domain_id, &domain,
312
+ NULL, NULL, NULL,
313
+ NULL);
314
314
 
315
315
  rb_scan_args(argc, argv, "11", &rb_key, &options);
316
316
 
317
317
  RVAL2GRNKEY(rb_key, context, key, domain_id, domain, self);
318
318
 
319
319
  rb_grn_scan_options(options,
320
- "result", &rb_result,
321
- "operator", &rb_operator,
322
- "type", &rb_type,
323
- NULL);
320
+ "result", &rb_result,
321
+ "operator", &rb_operator,
322
+ "type", &rb_type,
323
+ NULL);
324
324
 
325
325
  if (NIL_P(rb_result)) {
326
- result = grn_table_create(context, NULL, 0, NULL,
327
- GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
328
- table, 0);
329
- rb_grn_context_check(context, self);
330
- rb_result = GRNOBJECT2RVAL(Qnil, context, result, GRN_TRUE);
326
+ result = grn_table_create(context, NULL, 0, NULL,
327
+ GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC,
328
+ table, 0);
329
+ rb_grn_context_check(context, self);
330
+ rb_result = GRNOBJECT2RVAL(Qnil, context, result, GRN_TRUE);
331
331
  } else {
332
- result = RVAL2GRNOBJECT(rb_result, &context);
332
+ result = RVAL2GRNOBJECT(rb_result, &context);
333
333
  }
334
334
 
335
335
  operator = RVAL2GRNOPERATOR(rb_operator);
336
336
 
337
337
  rc = grn_obj_search(context, table, key,
338
- result, operator,
339
- search_options_is_set ? &search_options : NULL);
338
+ result, operator,
339
+ search_options_is_set ? &search_options : NULL);
340
340
  rb_grn_rc_check(rc, self);
341
341
 
342
342
  return rb_result;
@@ -357,81 +357,81 @@ rb_grn_double_array_trie_open_grn_prefix_cursor (int argc, VALUE *argv,
357
357
  VALUE rb_greater_than, rb_less_than, rb_offset, rb_limit;
358
358
 
359
359
  rb_grn_table_deconstruct((RbGrnTable *)SELF(self), &table, context,
360
- NULL, NULL,
361
- NULL, NULL, NULL,
362
- NULL);
360
+ NULL, NULL,
361
+ NULL, NULL, NULL,
362
+ NULL);
363
363
 
364
364
  rb_scan_args(argc, argv, "11", &rb_prefix, &options);
365
365
 
366
366
  rb_grn_scan_options(options,
367
- "key_bytes", &rb_key_bytes,
367
+ "key_bytes", &rb_key_bytes,
368
368
  "key_bites", &rb_key_bits,
369
369
  "offset", &rb_offset,
370
370
  "limit", &rb_limit,
371
- "order", &rb_order,
372
- "order_by", &rb_order_by,
373
- "greater_than", &rb_greater_than,
374
- "less_than", &rb_less_than,
375
- NULL);
371
+ "order", &rb_order,
372
+ "order_by", &rb_order_by,
373
+ "greater_than", &rb_greater_than,
374
+ "less_than", &rb_less_than,
375
+ NULL);
376
376
 
377
377
  prefix = StringValuePtr(rb_prefix);
378
378
  if (!NIL_P(rb_key_bytes) && !NIL_P(rb_key_bits)) {
379
- rb_raise(rb_eArgError,
380
- "should not specify both :key_bytes and :key_bits once: %s",
381
- rb_grn_inspect(rb_ary_new4(argc, argv)));
379
+ rb_raise(rb_eArgError,
380
+ "should not specify both :key_bytes and :key_bits once: %s",
381
+ rb_grn_inspect(rb_ary_new4(argc, argv)));
382
382
  } else if (!NIL_P(rb_key_bytes)) {
383
- prefix_size = NUM2UINT(rb_key_bytes);
383
+ prefix_size = NUM2UINT(rb_key_bytes);
384
384
  } else if (!NIL_P(rb_key_bits)) {
385
- prefix_size = NUM2UINT(rb_key_bits);
386
- flags |= GRN_CURSOR_SIZE_BY_BIT;
385
+ prefix_size = NUM2UINT(rb_key_bits);
386
+ flags |= GRN_CURSOR_SIZE_BY_BIT;
387
387
  } else {
388
- prefix_size = RSTRING_LEN(rb_prefix);
388
+ prefix_size = RSTRING_LEN(rb_prefix);
389
389
  }
390
390
  if (!NIL_P(rb_offset))
391
- offset = NUM2INT(rb_offset);
391
+ offset = NUM2INT(rb_offset);
392
392
  if (!NIL_P(rb_limit))
393
- limit = NUM2INT(rb_limit);
393
+ limit = NUM2INT(rb_limit);
394
394
 
395
395
  if (NIL_P(rb_order)) {
396
396
  } else if (rb_grn_equal_option(rb_order, "asc") ||
397
- rb_grn_equal_option(rb_order, "ascending")) {
398
- flags |= GRN_CURSOR_ASCENDING;
397
+ rb_grn_equal_option(rb_order, "ascending")) {
398
+ flags |= GRN_CURSOR_ASCENDING;
399
399
  } else if (rb_grn_equal_option(rb_order, "desc") ||
400
- rb_grn_equal_option(rb_order, "descending")) {
401
- flags |= GRN_CURSOR_DESCENDING;
400
+ rb_grn_equal_option(rb_order, "descending")) {
401
+ flags |= GRN_CURSOR_DESCENDING;
402
402
  } else {
403
- rb_raise(rb_eArgError,
404
- "order should be one of "
405
- "[:asc, :ascending, :desc, :descending]: %s",
406
- rb_grn_inspect(rb_order));
403
+ rb_raise(rb_eArgError,
404
+ "order should be one of "
405
+ "[:asc, :ascending, :desc, :descending]: %s",
406
+ rb_grn_inspect(rb_order));
407
407
  }
408
408
  if (NIL_P(rb_order_by)) {
409
409
  } else if (rb_grn_equal_option(rb_order_by, "id")) {
410
- flags |= GRN_CURSOR_BY_ID;
410
+ flags |= GRN_CURSOR_BY_ID;
411
411
  } else if (rb_grn_equal_option(rb_order_by, "key")) {
412
- if (table->header.type != GRN_TABLE_PAT_KEY) {
413
- rb_raise(rb_eArgError,
414
- "order_by => :key is available "
415
- "only for Groonga::DoubleArrayTrie: %s",
416
- rb_grn_inspect(self));
417
- }
418
- flags |= GRN_CURSOR_BY_KEY;
412
+ if (table->header.type != GRN_TABLE_PAT_KEY) {
413
+ rb_raise(rb_eArgError,
414
+ "order_by => :key is available "
415
+ "only for Groonga::DoubleArrayTrie: %s",
416
+ rb_grn_inspect(self));
417
+ }
418
+ flags |= GRN_CURSOR_BY_KEY;
419
419
  } else {
420
- rb_raise(rb_eArgError,
421
- "order_by should be one of [:id%s]: %s",
422
- table->header.type == GRN_TABLE_PAT_KEY ? ", :key" : "",
423
- rb_grn_inspect(rb_order_by));
420
+ rb_raise(rb_eArgError,
421
+ "order_by should be one of [:id%s]: %s",
422
+ table->header.type == GRN_TABLE_PAT_KEY ? ", :key" : "",
423
+ rb_grn_inspect(rb_order_by));
424
424
  }
425
425
 
426
426
  if (RVAL2CBOOL(rb_greater_than))
427
- flags |= GRN_CURSOR_GT;
427
+ flags |= GRN_CURSOR_GT;
428
428
  if (RVAL2CBOOL(rb_less_than))
429
- flags |= GRN_CURSOR_LT;
429
+ flags |= GRN_CURSOR_LT;
430
430
 
431
431
  cursor = grn_table_cursor_open(*context, table,
432
- prefix, prefix_size,
433
- NULL, 0,
434
- offset, limit, flags);
432
+ prefix, prefix_size,
433
+ NULL, 0,
434
+ offset, limit, flags);
435
435
  rb_grn_context_check(*context, self);
436
436
 
437
437
  return cursor;
@@ -486,28 +486,28 @@ rb_grn_double_array_trie_open_prefix_cursor (int argc, VALUE *argv, VALUE self)
486
486
  VALUE rb_cursor;
487
487
 
488
488
  cursor = rb_grn_double_array_trie_open_grn_prefix_cursor(argc, argv,
489
- self, &context);
489
+ self, &context);
490
490
  rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
491
491
  rb_iv_set(rb_cursor, "@table", self); /* FIXME: cursor should mark table */
492
492
  if (rb_block_given_p())
493
- return rb_ensure(rb_yield, rb_cursor, rb_grn_object_close, rb_cursor);
493
+ return rb_ensure(rb_yield, rb_cursor, rb_grn_object_close, rb_cursor);
494
494
  else
495
- return rb_cursor;
495
+ return rb_cursor;
496
496
  }
497
497
 
498
498
  void
499
499
  rb_grn_init_double_array_trie (VALUE mGrn)
500
500
  {
501
501
  rb_cGrnDoubleArrayTrie =
502
- rb_define_class_under(mGrn, "DoubleArrayTrie", rb_cGrnTable);
502
+ rb_define_class_under(mGrn, "DoubleArrayTrie", rb_cGrnTable);
503
503
 
504
504
  rb_include_module(rb_cGrnDoubleArrayTrie, rb_mGrnTableKeySupport);
505
505
  rb_define_singleton_method(rb_cGrnDoubleArrayTrie, "create",
506
- rb_grn_double_array_trie_s_create, -1);
506
+ rb_grn_double_array_trie_s_create, -1);
507
507
 
508
508
  rb_define_method(rb_cGrnDoubleArrayTrie, "search",
509
- rb_grn_double_array_trie_search, -1);
509
+ rb_grn_double_array_trie_search, -1);
510
510
 
511
511
  rb_define_method(rb_cGrnDoubleArrayTrie, "open_prefix_cursor",
512
- rb_grn_double_array_trie_open_prefix_cursor, -1);
512
+ rb_grn_double_array_trie_open_prefix_cursor, -1);
513
513
  }