rroonga 9.0.3 → 11.0.0

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/Rakefile +26 -135
  4. data/doc/text/news.md +79 -1
  5. data/doc/text/tutorial.md +1 -1
  6. data/ext/groonga/extconf.rb +19 -74
  7. data/ext/groonga/rb-grn-accessor.c +2 -2
  8. data/ext/groonga/rb-grn-column-cache.c +3 -3
  9. data/ext/groonga/rb-grn-column.c +4 -4
  10. data/ext/groonga/rb-grn-context.c +109 -58
  11. data/ext/groonga/rb-grn-data-column.c +4 -4
  12. data/ext/groonga/rb-grn-database.c +45 -26
  13. data/ext/groonga/rb-grn-double-array-trie.c +2 -2
  14. data/ext/groonga/rb-grn-encoding-support.c +2 -2
  15. data/ext/groonga/rb-grn-exception.c +14 -0
  16. data/ext/groonga/rb-grn-expression-builder.c +3 -3
  17. data/ext/groonga/rb-grn-expression.c +3 -3
  18. data/ext/groonga/rb-grn-fix-size-column.c +2 -2
  19. data/ext/groonga/rb-grn-flushable.c +9 -1
  20. data/ext/groonga/rb-grn-hash.c +2 -2
  21. data/ext/groonga/rb-grn-index-column.c +30 -2
  22. data/ext/groonga/rb-grn-index-cursor.c +21 -2
  23. data/ext/groonga/rb-grn-inverted-index-cursor.c +3 -3
  24. data/ext/groonga/rb-grn-logger.c +17 -3
  25. data/ext/groonga/rb-grn-object.c +266 -31
  26. data/ext/groonga/rb-grn-operator.c +100 -259
  27. data/ext/groonga/rb-grn-patricia-trie.c +2 -2
  28. data/ext/groonga/rb-grn-plugin.c +34 -22
  29. data/ext/groonga/rb-grn-request-timer-id.c +2 -2
  30. data/ext/groonga/rb-grn-snippet.c +3 -3
  31. data/ext/groonga/rb-grn-table-cursor-key-support.c +2 -2
  32. data/ext/groonga/rb-grn-table-cursor.c +3 -3
  33. data/ext/groonga/rb-grn-table-key-support.c +28 -9
  34. data/ext/groonga/rb-grn-table.c +180 -130
  35. data/ext/groonga/rb-grn-type.c +5 -1
  36. data/ext/groonga/rb-grn-utils.c +17 -1
  37. data/ext/groonga/rb-grn-variable-size-column.c +2 -2
  38. data/ext/groonga/rb-grn-variable.c +2 -2
  39. data/ext/groonga/rb-grn.h +11 -14
  40. data/ext/groonga/rb-groonga.c +6 -2
  41. data/lib/groonga.rb +3 -7
  42. data/lib/groonga/context.rb +32 -0
  43. data/lib/groonga/dumper.rb +3 -0
  44. data/lib/groonga/record.rb +2 -2
  45. data/rroonga-build.rb +5 -4
  46. data/rroonga.gemspec +8 -6
  47. data/test/groonga-test-utils.rb +37 -5
  48. data/test/run-test.rb +1 -3
  49. data/test/test-accessor.rb +63 -7
  50. data/test/test-column.rb +12 -1
  51. data/test/test-context.rb +25 -0
  52. data/test/test-exception.rb +5 -0
  53. data/test/test-flushable.rb +51 -6
  54. data/test/test-index-column.rb +70 -9
  55. data/test/test-index-cursor.rb +26 -0
  56. data/test/test-logger.rb +56 -11
  57. data/test/test-plugin.rb +1 -0
  58. data/test/test-query-logger.rb +4 -3
  59. data/test/test-ractor.rb +65 -0
  60. data/test/test-record.rb +2 -1
  61. data/test/test-remote.rb +58 -10
  62. data/test/test-schema-dumper.rb +13 -0
  63. data/test/test-schema.rb +9 -1
  64. data/test/test-table-arrow.rb +22 -10
  65. data/test/test-table.rb +21 -1
  66. data/test/test-variable.rb +23 -7
  67. metadata +72 -97
@@ -325,353 +325,194 @@ rb_grn_init_operator (VALUE mGrn)
325
325
  rb_grn_init_prefix_operator(mGrn);
326
326
  rb_grn_init_regexp_operator(mGrn);
327
327
 
328
+ #define OPERATOR_NEW(klass, name, NAME) \
329
+ rb_obj_freeze(rb_funcall(klass, rb_intern("new"), 2, \
330
+ rb_obj_freeze(rb_str_new_cstr(name)), \
331
+ UINT2NUM(GRN_OP_ ## NAME)))
332
+
328
333
  rb_define_const(rb_cGrnOperator, "PUSH",
329
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
330
- rb_str_new_cstr("push"),
331
- UINT2NUM(GRN_OP_PUSH)));
334
+ OPERATOR_NEW(rb_cGrnOperator, "push", PUSH));
332
335
  rb_define_const(rb_cGrnOperator, "POP",
333
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
334
- rb_str_new_cstr("pop"),
335
- UINT2NUM(GRN_OP_POP)));
336
+ OPERATOR_NEW(rb_cGrnOperator, "pop", POP));
336
337
  rb_define_const(rb_cGrnOperator, "NO_OPERATION",
337
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
338
- rb_str_new_cstr("no-operation"),
339
- UINT2NUM(GRN_OP_NOP)));
338
+ OPERATOR_NEW(rb_cGrnOperator, "no-operation", NOP));
340
339
  rb_define_const(rb_cGrnOperator, "CALL",
341
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
342
- rb_str_new_cstr("call"),
343
- UINT2NUM(GRN_OP_CALL)));
340
+ OPERATOR_NEW(rb_cGrnOperator, "call", CALL));
344
341
  rb_define_const(rb_cGrnOperator, "INTERN",
345
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
346
- rb_str_new_cstr("intern"),
347
- UINT2NUM(GRN_OP_INTERN)));
342
+ OPERATOR_NEW(rb_cGrnOperator, "intern", INTERN));
348
343
  rb_define_const(rb_cGrnOperator, "GET_REFERENCE",
349
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
350
- rb_str_new_cstr("get-reference"),
351
- UINT2NUM(GRN_OP_GET_REF)));
344
+ OPERATOR_NEW(rb_cGrnOperator, "get-reference", GET_REF));
352
345
  rb_define_const(rb_cGrnOperator, "GET_VALUE",
353
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
354
- rb_str_new_cstr("get-value"),
355
- UINT2NUM(GRN_OP_GET_VALUE)));
346
+ OPERATOR_NEW(rb_cGrnOperator, "get-value", GET_VALUE));
356
347
  rb_define_const(rb_cGrnOperator, "AND",
357
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
358
- rb_str_new_cstr("and"),
359
- UINT2NUM(GRN_OP_AND)));
348
+ OPERATOR_NEW(rb_cGrnOperator, "and", AND));
360
349
  rb_define_const(rb_cGrnOperator, "AND_NOT",
361
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
362
- rb_str_new_cstr("and-not"),
363
- UINT2NUM(GRN_OP_AND_NOT)));
364
- /* Just for backward compatiblity. TODO: REMOVE ME! */
350
+ OPERATOR_NEW(rb_cGrnOperator, "and-not", AND_NOT));
351
+ /* Just for backward compatibility. TODO: REMOVE ME! */
365
352
  rb_define_const(rb_cGrnOperator, "BUT",
366
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
367
- rb_str_new_cstr("but"),
368
- UINT2NUM(GRN_OP_BUT)));
353
+ OPERATOR_NEW(rb_cGrnOperator, "but", BUT));
369
354
  rb_define_const(rb_cGrnOperator, "OR",
370
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
371
- rb_str_new_cstr("or"),
372
- UINT2NUM(GRN_OP_OR)));
355
+ OPERATOR_NEW(rb_cGrnOperator, "or", OR));
373
356
  rb_define_const(rb_cGrnOperator, "ASSIGN",
374
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
375
- rb_str_new_cstr("assign"),
376
- UINT2NUM(GRN_OP_ASSIGN)));
357
+ OPERATOR_NEW(rb_cGrnOperator, "assign", ASSIGN));
377
358
  rb_define_const(rb_cGrnOperator, "STAR_ASSIGN",
378
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
379
- rb_str_new_cstr("star-assign"),
380
- UINT2NUM(GRN_OP_STAR_ASSIGN)));
359
+ OPERATOR_NEW(rb_cGrnOperator, "star-assign", STAR_ASSIGN));
381
360
  rb_define_const(rb_cGrnOperator, "SLASH_ASSIGN",
382
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
383
- rb_str_new_cstr("slash-assign"),
384
- UINT2NUM(GRN_OP_SLASH_ASSIGN)));
361
+ OPERATOR_NEW(rb_cGrnOperator, "slash-assign", SLASH_ASSIGN));
385
362
  rb_define_const(rb_cGrnOperator, "MODULO_ASSIGN",
386
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
387
- rb_str_new_cstr("modulo-assign"),
388
- UINT2NUM(GRN_OP_MOD_ASSIGN)));
363
+ OPERATOR_NEW(rb_cGrnOperator, "modulo-assign", MOD_ASSIGN));
389
364
  rb_define_const(rb_cGrnOperator, "PLUS_ASSIGN",
390
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
391
- rb_str_new_cstr("plus-assign"),
392
- UINT2NUM(GRN_OP_PLUS_ASSIGN)));
365
+ OPERATOR_NEW(rb_cGrnOperator, "plus-assign", PLUS_ASSIGN));
393
366
  rb_define_const(rb_cGrnOperator, "MINUS_ASSIGN",
394
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
395
- rb_str_new_cstr("minus-assign"),
396
- UINT2NUM(GRN_OP_MINUS_ASSIGN)));
367
+ OPERATOR_NEW(rb_cGrnOperator, "minus-assign", MINUS_ASSIGN));
397
368
  rb_define_const(rb_cGrnOperator, "SHIFTL_ASSIGN",
398
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
399
- rb_str_new_cstr("shiftl-assign"),
400
- UINT2NUM(GRN_OP_SHIFTL_ASSIGN)));
369
+ OPERATOR_NEW(rb_cGrnOperator, "shiftl-assign", SHIFTL_ASSIGN));
401
370
  rb_define_const(rb_cGrnOperator, "SHIRTR_ASSIGN",
402
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
403
- rb_str_new_cstr("shirtr-assign"),
404
- UINT2NUM(GRN_OP_SHIFTR_ASSIGN)));
371
+ OPERATOR_NEW(rb_cGrnOperator, "shirtr-assign", SHIFTR_ASSIGN));
405
372
  rb_define_const(rb_cGrnOperator, "SHIFTRR_ASSIGN",
406
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
407
- rb_str_new_cstr("shiftrr-assign"),
408
- UINT2NUM(GRN_OP_SHIFTRR_ASSIGN)));
373
+ OPERATOR_NEW(rb_cGrnOperator, "shiftrr-assign", SHIFTRR_ASSIGN));
409
374
  rb_define_const(rb_cGrnOperator, "AND_ASSIGN",
410
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
411
- rb_str_new_cstr("and-assign"),
412
- UINT2NUM(GRN_OP_AND_ASSIGN)));
375
+ OPERATOR_NEW(rb_cGrnOperator, "and-assign", AND_ASSIGN));
413
376
  rb_define_const(rb_cGrnOperator, "XOR_ASSIGN",
414
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
415
- rb_str_new_cstr("xor-assign"),
416
- UINT2NUM(GRN_OP_XOR_ASSIGN)));
377
+ OPERATOR_NEW(rb_cGrnOperator, "xor-assign", XOR_ASSIGN));
417
378
  rb_define_const(rb_cGrnOperator, "OR_ASSIGN",
418
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
419
- rb_str_new_cstr("or-assign"),
420
- UINT2NUM(GRN_OP_OR_ASSIGN)));
379
+ OPERATOR_NEW(rb_cGrnOperator, "or-assign", OR_ASSIGN));
421
380
  rb_define_const(rb_cGrnOperator, "JUMP",
422
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
423
- rb_str_new_cstr("jump"),
424
- UINT2NUM(GRN_OP_JUMP)));
381
+ OPERATOR_NEW(rb_cGrnOperator, "jump", JUMP));
425
382
  rb_define_const(rb_cGrnOperator, "CJUMP",
426
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
427
- rb_str_new_cstr("cjump"),
428
- UINT2NUM(GRN_OP_CJUMP)));
383
+ OPERATOR_NEW(rb_cGrnOperator, "cjump", CJUMP));
429
384
  rb_define_const(rb_cGrnOperator, "COMMA",
430
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
431
- rb_str_new_cstr("comma"),
432
- UINT2NUM(GRN_OP_COMMA)));
385
+ OPERATOR_NEW(rb_cGrnOperator, "comma", COMMA));
433
386
  rb_define_const(rb_cGrnOperator, "BITWISE_OR",
434
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
435
- rb_str_new_cstr("bitwise-or"),
436
- UINT2NUM(GRN_OP_BITWISE_OR)));
387
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-or", BITWISE_OR));
437
388
  rb_define_const(rb_cGrnOperator, "BITWISE_XOR",
438
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
439
- rb_str_new_cstr("bitwise-xor"),
440
- UINT2NUM(GRN_OP_BITWISE_XOR)));
389
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-xor", BITWISE_XOR));
441
390
  rb_define_const(rb_cGrnOperator, "BITWISE_AND",
442
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
443
- rb_str_new_cstr("bitwise-and"),
444
- UINT2NUM(GRN_OP_BITWISE_AND)));
391
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-and", BITWISE_AND));
445
392
  rb_define_const(rb_cGrnOperator, "BITWISE_NOT",
446
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
447
- rb_str_new_cstr("bitwise-not"),
448
- UINT2NUM(GRN_OP_BITWISE_NOT)));
393
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-not", BITWISE_NOT));
449
394
  rb_define_const(rb_cGrnOperator, "EQUAL",
450
- rb_funcall(rb_cGrnEqualOperator, rb_intern("new"), 2,
451
- rb_str_new_cstr("equal"),
452
- UINT2NUM(GRN_OP_EQUAL)));
395
+ OPERATOR_NEW(rb_cGrnEqualOperator, "equal", EQUAL));
453
396
  rb_define_const(rb_cGrnOperator, "NOT_EQUAL",
454
- rb_funcall(rb_cGrnNotEqualOperator, rb_intern("new"), 2,
455
- rb_str_new_cstr("not-equal"),
456
- UINT2NUM(GRN_OP_NOT_EQUAL)));
397
+ OPERATOR_NEW(rb_cGrnNotEqualOperator,
398
+ "not-equal",
399
+ NOT_EQUAL));
457
400
  rb_define_const(rb_cGrnOperator, "LESS",
458
- rb_funcall(rb_cGrnLessOperator, rb_intern("new"), 2,
459
- rb_str_new_cstr("less"),
460
- UINT2NUM(GRN_OP_LESS)));
401
+ OPERATOR_NEW(rb_cGrnLessOperator, "less", LESS));
461
402
  rb_define_const(rb_cGrnOperator, "GREATER",
462
- rb_funcall(rb_cGrnGreaterOperator, rb_intern("new"), 2,
463
- rb_str_new_cstr("greater"),
464
- UINT2NUM(GRN_OP_GREATER)));
403
+ OPERATOR_NEW(rb_cGrnGreaterOperator, "greater", GREATER));
465
404
  rb_define_const(rb_cGrnOperator, "LESS_EQUAL",
466
- rb_funcall(rb_cGrnLessEqualOperator, rb_intern("new"), 2,
467
- rb_str_new_cstr("less-equal"),
468
- UINT2NUM(GRN_OP_LESS_EQUAL)));
405
+ OPERATOR_NEW(rb_cGrnLessEqualOperator,
406
+ "less-equal",
407
+ LESS_EQUAL));
469
408
  rb_define_const(rb_cGrnOperator, "GREATER_EQUAL",
470
- rb_funcall(rb_cGrnGreaterEqualOperator, rb_intern("new"), 2,
471
- rb_str_new_cstr("greater-equal"),
472
- UINT2NUM(GRN_OP_GREATER_EQUAL)));
409
+ OPERATOR_NEW(rb_cGrnGreaterEqualOperator,
410
+ "greater-equal",
411
+ GREATER_EQUAL));
473
412
  rb_define_const(rb_cGrnOperator, "IN",
474
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
475
- rb_str_new_cstr("in"),
476
- UINT2NUM(GRN_OP_IN)));
413
+ OPERATOR_NEW(rb_cGrnOperator, "in", IN));
477
414
  rb_define_const(rb_cGrnOperator, "MATCH",
478
- rb_funcall(rb_cGrnMatchOperator, rb_intern("new"), 2,
479
- rb_str_new_cstr("match"),
480
- UINT2NUM(GRN_OP_MATCH)));
415
+ OPERATOR_NEW(rb_cGrnMatchOperator, "match", MATCH));
481
416
  rb_define_const(rb_cGrnOperator, "NEAR",
482
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
483
- rb_str_new_cstr("near"),
484
- UINT2NUM(GRN_OP_NEAR)));
417
+ OPERATOR_NEW(rb_cGrnOperator, "near", NEAR));
485
418
  rb_define_const(rb_cGrnOperator, "NEAR2",
486
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
487
- rb_str_new_cstr("near2"),
488
- UINT2NUM(GRN_OP_NEAR2)));
419
+ OPERATOR_NEW(rb_cGrnOperator, "near2", NEAR2));
489
420
  rb_define_const(rb_cGrnOperator, "SIMILAR",
490
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
491
- rb_str_new_cstr("similar"),
492
- UINT2NUM(GRN_OP_SIMILAR)));
421
+ OPERATOR_NEW(rb_cGrnOperator, "similar", SIMILAR));
493
422
  rb_define_const(rb_cGrnOperator, "TERM_EXTRACT",
494
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
495
- rb_str_new_cstr("term-extract"),
496
- UINT2NUM(GRN_OP_TERM_EXTRACT)));
423
+ OPERATOR_NEW(rb_cGrnOperator, "term-extract", TERM_EXTRACT));
497
424
  rb_define_const(rb_cGrnOperator, "SHIFTL",
498
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
499
- rb_str_new_cstr("shiftl"),
500
- UINT2NUM(GRN_OP_SHIFTL)));
425
+ OPERATOR_NEW(rb_cGrnOperator, "shiftl", SHIFTL));
501
426
  rb_define_const(rb_cGrnOperator, "SHIFTR",
502
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
503
- rb_str_new_cstr("shiftr"),
504
- UINT2NUM(GRN_OP_SHIFTR)));
427
+ OPERATOR_NEW(rb_cGrnOperator, "shiftr", SHIFTR));
505
428
  rb_define_const(rb_cGrnOperator, "SHIFTRR",
506
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
507
- rb_str_new_cstr("shiftrr"),
508
- UINT2NUM(GRN_OP_SHIFTRR)));
429
+ OPERATOR_NEW(rb_cGrnOperator, "shiftrr", SHIFTRR));
509
430
  rb_define_const(rb_cGrnOperator, "PLUS",
510
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
511
- rb_str_new_cstr("plus"),
512
- UINT2NUM(GRN_OP_PLUS)));
431
+ OPERATOR_NEW(rb_cGrnOperator, "plus", PLUS));
513
432
  rb_define_const(rb_cGrnOperator, "MINUS",
514
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
515
- rb_str_new_cstr("minus"),
516
- UINT2NUM(GRN_OP_MINUS)));
433
+ OPERATOR_NEW(rb_cGrnOperator, "minus", MINUS));
517
434
  rb_define_const(rb_cGrnOperator, "STAR",
518
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
519
- rb_str_new_cstr("star"),
520
- UINT2NUM(GRN_OP_STAR)));
435
+ OPERATOR_NEW(rb_cGrnOperator, "star", STAR));
521
436
  rb_define_const(rb_cGrnOperator, "SLASH",
522
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
523
- rb_str_new_cstr("slash"),
524
- UINT2NUM(GRN_OP_SLASH)));
437
+ OPERATOR_NEW(rb_cGrnOperator, "slash", SLASH));
525
438
  rb_define_const(rb_cGrnOperator, "MODULO",
526
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
527
- rb_str_new_cstr("modulo"),
528
- UINT2NUM(GRN_OP_MOD)));
439
+ OPERATOR_NEW(rb_cGrnOperator, "modulo", MOD));
529
440
  rb_define_const(rb_cGrnOperator, "DELETE",
530
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
531
- rb_str_new_cstr("delete"),
532
- UINT2NUM(GRN_OP_DELETE)));
441
+ OPERATOR_NEW(rb_cGrnOperator, "delete", DELETE));
533
442
  rb_define_const(rb_cGrnOperator, "INCREMENT",
534
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
535
- rb_str_new_cstr("increment"),
536
- UINT2NUM(GRN_OP_INCR)));
443
+ OPERATOR_NEW(rb_cGrnOperator, "increment", INCR));
537
444
  rb_define_const(rb_cGrnOperator, "DECREMENT",
538
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
539
- rb_str_new_cstr("decrement"),
540
- UINT2NUM(GRN_OP_DECR)));
445
+ OPERATOR_NEW(rb_cGrnOperator, "decrement", DECR));
541
446
  rb_define_const(rb_cGrnOperator, "INCREMENT_POST",
542
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
543
- rb_str_new_cstr("increment-post"),
544
- UINT2NUM(GRN_OP_INCR_POST)));
447
+ OPERATOR_NEW(rb_cGrnOperator, "increment-post", INCR_POST));
545
448
  rb_define_const(rb_cGrnOperator, "DECREMENT_POST",
546
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
547
- rb_str_new_cstr("decrement-post"),
548
- UINT2NUM(GRN_OP_DECR_POST)));
449
+ OPERATOR_NEW(rb_cGrnOperator, "decrement-post", DECR_POST));
549
450
  rb_define_const(rb_cGrnOperator, "NOT",
550
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
551
- rb_str_new_cstr("not"),
552
- UINT2NUM(GRN_OP_NOT)));
451
+ OPERATOR_NEW(rb_cGrnOperator, "not", NOT));
553
452
  rb_define_const(rb_cGrnOperator, "ADJUST",
554
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
555
- rb_str_new_cstr("adjust"),
556
- UINT2NUM(GRN_OP_ADJUST)));
453
+ OPERATOR_NEW(rb_cGrnOperator, "adjust", ADJUST));
557
454
  rb_define_const(rb_cGrnOperator, "EXACT",
558
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
559
- rb_str_new_cstr("exact"),
560
- UINT2NUM(GRN_OP_EXACT)));
455
+ OPERATOR_NEW(rb_cGrnOperator, "exact", EXACT));
561
456
  rb_define_const(rb_cGrnOperator, "LONGEST_COMMON_PREFIX",
562
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
563
- rb_str_new_cstr("longest-common-prefix"),
564
- UINT2NUM(GRN_OP_LCP)));
457
+ OPERATOR_NEW(rb_cGrnOperator, "longest-common-prefix", LCP));
565
458
  rb_define_const(rb_cGrnOperator, "PARTIAL",
566
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
567
- rb_str_new_cstr("partial"),
568
- UINT2NUM(GRN_OP_PARTIAL)));
459
+ OPERATOR_NEW(rb_cGrnOperator, "partial", PARTIAL));
569
460
  rb_define_const(rb_cGrnOperator, "UNSPLIT",
570
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
571
- rb_str_new_cstr("unsplit"),
572
- UINT2NUM(GRN_OP_UNSPLIT)));
461
+ OPERATOR_NEW(rb_cGrnOperator, "unsplit", UNSPLIT));
573
462
  rb_define_const(rb_cGrnOperator, "PREFIX",
574
- rb_funcall(rb_cGrnPrefixOperator, rb_intern("new"), 2,
575
- rb_str_new_cstr("prefix"),
576
- UINT2NUM(GRN_OP_PREFIX)));
463
+ OPERATOR_NEW(rb_cGrnPrefixOperator, "prefix", PREFIX));
577
464
  rb_define_const(rb_cGrnOperator, "SUFFIX",
578
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
579
- rb_str_new_cstr("suffix"),
580
- UINT2NUM(GRN_OP_SUFFIX)));
465
+ OPERATOR_NEW(rb_cGrnOperator, "suffix", SUFFIX));
581
466
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE1",
582
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
583
- rb_str_new_cstr("geo-distance1"),
584
- UINT2NUM(GRN_OP_GEO_DISTANCE1)));
467
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance1", GEO_DISTANCE1));
585
468
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE2",
586
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
587
- rb_str_new_cstr("geo-distance2"),
588
- UINT2NUM(GRN_OP_GEO_DISTANCE2)));
469
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance2", GEO_DISTANCE2));
589
470
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE3",
590
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
591
- rb_str_new_cstr("geo-distance3"),
592
- UINT2NUM(GRN_OP_GEO_DISTANCE3)));
471
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance3", GEO_DISTANCE3));
593
472
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE4",
594
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
595
- rb_str_new_cstr("geo-distance4"),
596
- UINT2NUM(GRN_OP_GEO_DISTANCE4)));
473
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance4", GEO_DISTANCE4));
597
474
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP5",
598
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
599
- rb_str_new_cstr("geo-withinp5"),
600
- UINT2NUM(GRN_OP_GEO_WITHINP5)));
475
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp5", GEO_WITHINP5));
601
476
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP6",
602
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
603
- rb_str_new_cstr("geo-withinp6"),
604
- UINT2NUM(GRN_OP_GEO_WITHINP6)));
477
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp6", GEO_WITHINP6));
605
478
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP8",
606
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
607
- rb_str_new_cstr("geo-withinp8"),
608
- UINT2NUM(GRN_OP_GEO_WITHINP8)));
479
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp8", GEO_WITHINP8));
609
480
  rb_define_const(rb_cGrnOperator, "OBJECT_SEARCH",
610
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
611
- rb_str_new_cstr("object-search"),
612
- UINT2NUM(GRN_OP_OBJ_SEARCH)));
481
+ OPERATOR_NEW(rb_cGrnOperator, "object-search", OBJ_SEARCH));
613
482
  rb_define_const(rb_cGrnOperator, "EXPRESSION_GET_VARIABLE",
614
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
615
- rb_str_new_cstr("expression-get-variable"),
616
- UINT2NUM(GRN_OP_EXPR_GET_VAR)));
483
+ OPERATOR_NEW(rb_cGrnOperator, "expression-get-variable", EXPR_GET_VAR));
617
484
  rb_define_const(rb_cGrnOperator, "TABLE_CREATE",
618
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
619
- rb_str_new_cstr("table-create"),
620
- UINT2NUM(GRN_OP_TABLE_CREATE)));
485
+ OPERATOR_NEW(rb_cGrnOperator, "table-create", TABLE_CREATE));
621
486
  rb_define_const(rb_cGrnOperator, "TABLE_SELECT",
622
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
623
- rb_str_new_cstr("table-select"),
624
- UINT2NUM(GRN_OP_TABLE_SELECT)));
487
+ OPERATOR_NEW(rb_cGrnOperator, "table-select", TABLE_SELECT));
625
488
  rb_define_const(rb_cGrnOperator, "TABLE_SORT",
626
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
627
- rb_str_new_cstr("table-sort"),
628
- UINT2NUM(GRN_OP_TABLE_SORT)));
489
+ OPERATOR_NEW(rb_cGrnOperator, "table-sort", TABLE_SORT));
629
490
  rb_define_const(rb_cGrnOperator, "TABLE_GROUP",
630
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
631
- rb_str_new_cstr("table-group"),
632
- UINT2NUM(GRN_OP_TABLE_GROUP)));
491
+ OPERATOR_NEW(rb_cGrnOperator, "table-group", TABLE_GROUP));
633
492
  rb_define_const(rb_cGrnOperator, "JSON_PUT",
634
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
635
- rb_str_new_cstr("json-put"),
636
- UINT2NUM(GRN_OP_JSON_PUT)));
493
+ OPERATOR_NEW(rb_cGrnOperator, "json-put", JSON_PUT));
637
494
  rb_define_const(rb_cGrnOperator, "REGEXP",
638
- rb_funcall(rb_cGrnRegexpOperator, rb_intern("new"), 2,
639
- rb_str_new_cstr("regexp"),
640
- UINT2NUM(GRN_OP_REGEXP)));
495
+ OPERATOR_NEW(rb_cGrnRegexpOperator, "regexp", REGEXP));
641
496
  rb_define_const(rb_cGrnOperator, "FUZZY",
642
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
643
- rb_str_new_cstr("fuzzy"),
644
- UINT2NUM(GRN_OP_FUZZY)));
497
+ OPERATOR_NEW(rb_cGrnOperator, "fuzzy", FUZZY));
645
498
 
646
499
 
647
500
  /*
648
501
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE1",
649
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
650
- rb_str_new_cstr("geo-distance1"),
651
- UINT2NUM(GRN_OP_GEO_DISTANCE1)));
502
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance1", GEO_DISTANCE1));
652
503
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE2",
653
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
654
- rb_str_new_cstr("geo-distance2"),
655
- UINT2NUM(GRN_OP_GEO_DISTANCE2)));
504
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance2", GEO_DISTANCE2));
656
505
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE3",
657
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
658
- rb_str_new_cstr("geo-distance3"),
659
- UINT2NUM(GRN_OP_GEO_DISTANCE3)));
506
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance3", GEO_DISTANCE3));
660
507
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE4",
661
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
662
- rb_str_new_cstr("geo-distance4"),
663
- UINT2NUM(GRN_OP_GEO_DISTANCE4)));
508
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance4", GEO_DISTANCE4));
664
509
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP5",
665
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
666
- rb_str_new_cstr("geo-withinp5"),
667
- UINT2NUM(GRN_OP_GEO_WITHINP5)));
510
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp5", GEO_WITHINP5));
668
511
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP6",
669
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
670
- rb_str_new_cstr("geo-withinp6"),
671
- UINT2NUM(GRN_OP_GEO_WITHINP6)));
512
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp6", GEO_WITHINP6));
672
513
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP8",
673
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
674
- rb_str_new_cstr("geo-withinp8"),
675
- UINT2NUM(GRN_OP_GEO_WITHINP8)));
514
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp8", GEO_WITHINP8));
676
515
  */
516
+
517
+ #undef OPERATOR_NEW
677
518
  }