rroonga 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/Rakefile +5 -1
  2. data/ext/groonga/extconf.rb +36 -4
  3. data/ext/groonga/rb-grn-accessor.c +8 -10
  4. data/ext/groonga/rb-grn-array-cursor.c +2 -2
  5. data/ext/groonga/rb-grn-array.c +35 -59
  6. data/ext/groonga/rb-grn-column.c +105 -192
  7. data/ext/groonga/rb-grn-context.c +60 -63
  8. data/ext/groonga/rb-grn-database.c +27 -37
  9. data/ext/groonga/rb-grn-double-array-trie-cursor.c +3 -3
  10. data/ext/groonga/rb-grn-double-array-trie.c +75 -126
  11. data/ext/groonga/rb-grn-encoding.c +27 -27
  12. data/ext/groonga/rb-grn-expression.c +29 -24
  13. data/ext/groonga/rb-grn-fix-size-column.c +7 -9
  14. data/ext/groonga/rb-grn-hash-cursor.c +3 -3
  15. data/ext/groonga/rb-grn-hash.c +57 -108
  16. data/ext/groonga/rb-grn-index-column.c +17 -29
  17. data/ext/groonga/rb-grn-logger.c +11 -14
  18. data/ext/groonga/rb-grn-object.c +51 -94
  19. data/ext/groonga/rb-grn-patricia-trie-cursor.c +2 -2
  20. data/ext/groonga/rb-grn-patricia-trie.c +161 -276
  21. data/ext/groonga/rb-grn-plugin.c +6 -10
  22. data/ext/groonga/rb-grn-table-cursor.c +14 -21
  23. data/ext/groonga/rb-grn-table-key-support.c +32 -35
  24. data/ext/groonga/rb-grn-table.c +149 -252
  25. data/ext/groonga/rb-grn-variable.c +6 -7
  26. data/ext/groonga/rb-grn-view-accessor.c +1 -1
  27. data/ext/groonga/rb-grn-view-cursor.c +2 -2
  28. data/ext/groonga/rb-grn-view.c +28 -45
  29. data/ext/groonga/rb-grn.h +1 -1
  30. data/ext/groonga/rb-groonga.c +6 -6
  31. data/lib/groonga/database.rb +1 -1
  32. data/lib/groonga/dumper.rb +109 -33
  33. data/lib/groonga/expression-builder.rb +24 -0
  34. data/lib/groonga/pagination.rb +30 -24
  35. data/lib/groonga/record.rb +21 -18
  36. data/lib/groonga/schema.rb +156 -140
  37. data/test/test-command-select.rb +66 -1
  38. data/test/test-database-dumper.rb +50 -10
  39. data/test/test-expression-builder.rb +41 -0
  40. metadata +4 -4
@@ -97,7 +97,7 @@ rb_grn_index_column_deconstruct (RbGrnIndexColumn *rb_grn_index_column,
97
97
 
98
98
  /*
99
99
  * IDが _id_ であるレコードを高速に全文検索するため転置索引を作
100
- * 成する。多くの場合、Groonga::Table#define_index_columnで
100
+ * 成する。多くの場合、 {Groonga::Table#define_index_column}
101
101
  * +:source+ オプションを指定することにより、自動的に全文検索
102
102
  * 用の索引は更新されるので、明示的にこのメソッドを使うこと
103
103
  * は少ない。
@@ -147,15 +147,15 @@ rb_grn_index_column_deconstruct (RbGrnIndexColumn *rb_grn_index_column,
147
147
  * @option options :section
148
148
  * 段落番号を指定する。省略した場合は1を指定したとみなされ
149
149
  * る。
150
- * Groonga::Table#define_index_columnで
151
- * <tt>{:with_section => true}</tt>を指定していなければい
150
+ * {Groonga::Table#define_index_column}
151
+ * @{:with_section => true}@ を指定していなければい
152
152
  * けない。
153
153
  * @option options :old_value
154
154
  * 以前の値を指定する。省略した場合は現在の値が用いられる。
155
155
  * 通常は指定する必要はない。
156
156
  * @option options :value
157
157
  * 新しい値を指定する。 _value_ を指定した場合と _options_ で
158
- * <tt>{:value => value}</tt>を指定した場合は同じ動作とな
158
+ * @{:value => value}@ を指定した場合は同じ動作とな
159
159
  * る。
160
160
  */
161
161
  static VALUE
@@ -220,11 +220,10 @@ rb_grn_index_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
220
220
  }
221
221
 
222
222
  /*
223
- * インデックス対象となっているカラムの配列を返す。
223
+ * インデックス対象となっている {Groonga::Column} の配列を返す。
224
224
  *
225
225
  * @overload sources
226
- * @return [::Array<Groonga::Column>] インデックス対象となっている
227
- * {Groonga::Column}の配列
226
+ * @return [::Array<Groonga::Column>]
228
227
  */
229
228
  static VALUE
230
229
  rb_grn_index_column_get_sources (VALUE self)
@@ -399,7 +398,7 @@ rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
399
398
 
400
399
  /*
401
400
  * _object_ から _query_ に対応するオブジェクトを検索し、見つかっ
402
- * たオブジェクトのIDがキーになっているGroonga::Hashを返す。
401
+ * たオブジェクトのIDがキーになっている {Groonga::Hash} を返す。
403
402
  *
404
403
  * @overload search(query, options={})
405
404
  * @param [::Hash] options The name and value
@@ -408,9 +407,9 @@ rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
408
407
  * 結果を格納するGroonga::Hash。指定しない場合は新しく
409
408
  * Groonga::Hashを生成し、それに結果を格納して返す。
410
409
  * @option options :operator
411
- * 以下のどれかの値を指定する。 +nil+ , <tt>"or"</tt>, <tt>"||"</tt>,
412
- * <tt>"and"</tt>, <tt>"+"</tt>, <tt>"&&"</tt>, <tt>"but"</tt>,
413
- * <tt>"not"</tt>, <tt>"-"</tt>, <tt>"adjust"</tt>, <tt>">"</tt>。
410
+ * 以下のどれかの値を指定する。 +nil+ , @"or"@ , @"||"@ ,
411
+ * @"and"@ , @"+"@ , @"&&"@ , @"but"@ ,
412
+ * @"not"@ , @"-"@ , @"adjust"@ , @">"@ 。
414
413
  * それぞれ以下のようになる。(FIXME: 「以下」)
415
414
  * @option options :exact
416
415
  * +true+ を指定すると完全一致で検索する
@@ -426,9 +425,7 @@ rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
426
425
  * @option options :near
427
426
  * +true+ を指定すると _query_ に指定した複数の語が近傍に含ま
428
427
  * れるレコードを検索する
429
- * [...]
430
- * ...
431
- * @return [Groonga::Hash]
428
+ * @return [Groonga::Hash]
432
429
  */
433
430
  static VALUE
434
431
  rb_grn_index_column_search (int argc, VALUE *argv, VALUE self)
@@ -485,12 +482,9 @@ rb_grn_index_column_search (int argc, VALUE *argv, VALUE self)
485
482
  }
486
483
 
487
484
  /*
488
- * Document-method: with_section?
489
- *
490
- * call-seq:
491
- * column.with_section? -> true/false
492
- *
493
485
  * _column_ が段落情報も格納する場合は +true+ を返します。
486
+ *
487
+ * @overload with_section?
494
488
  */
495
489
  static VALUE
496
490
  rb_grn_index_column_with_section_p (VALUE self)
@@ -506,12 +500,9 @@ rb_grn_index_column_with_section_p (VALUE self)
506
500
  }
507
501
 
508
502
  /*
509
- * Document-method: with_weight?
510
- *
511
- * call-seq:
512
- * column.with_weight? -> true/false
513
- *
514
503
  * _column_ がウェイト情報も格納する場合は +true+ を返します。
504
+ *
505
+ * @overload with_weight?
515
506
  */
516
507
  static VALUE
517
508
  rb_grn_index_column_with_weight_p (VALUE self)
@@ -527,12 +518,9 @@ rb_grn_index_column_with_weight_p (VALUE self)
527
518
  }
528
519
 
529
520
  /*
530
- * Document-method: with_position?
531
- *
532
- * call-seq:
533
- * column.with_position? -> true/false
534
- *
535
521
  * _column_ が位置情報も格納する場合は +true+ を返します。
522
+ *
523
+ * @overload with_position?
536
524
  */
537
525
  static VALUE
538
526
  rb_grn_index_column_with_position_p (VALUE self)
@@ -337,14 +337,13 @@ rb_grn_logger_s_reopen_with_related_object (VALUE klass, VALUE related_object)
337
337
  }
338
338
 
339
339
  /*
340
- * call-seq:
341
- * Groonga::Logger.reopen
342
- *
343
340
  * groongaのデフォルトロガーがログを出力するファイルを再オー
344
341
  * プンする。ログファイルのバックアップ時などに使用する。
345
342
  *
346
- * Groonga::Logger.registerで独自のロガーを設定している場合
343
+ * {Groonga::Logger.register} で独自のロガーを設定している場合
347
344
  * は例外が発生する。
345
+ *
346
+ * @overload reopen
348
347
  */
349
348
  static VALUE
350
349
  rb_grn_logger_s_reopen (VALUE klass)
@@ -383,7 +382,7 @@ rb_grn_logger_s_set_path (VALUE klass, VALUE rb_path,
383
382
  * groongaのデフォルトロガーがログを出力するファイルのパスを返す。
384
383
  *
385
384
  * @overload log_path
386
- * @return [String] path ログを出力するファイルのパス
385
+ * @return [String]
387
386
  */
388
387
  static VALUE
389
388
  rb_grn_logger_s_get_log_path (VALUE klass)
@@ -401,14 +400,13 @@ rb_grn_logger_s_get_log_path (VALUE klass)
401
400
  }
402
401
 
403
402
  /*
404
- * call-seq:
405
- * Groonga::Logger.log_path= path
406
- *
407
403
  * groongaのデフォルトロガーがログを出力するファイルのパスを
408
404
  * 指定する。
409
405
  *
410
- * Groonga::Logger.registerで独自のロガーを設定している場合、
406
+ * {Groonga::Logger.register} で独自のロガーを設定している場合、
411
407
  * 設定している独自ロガーは無効になる。
408
+ *
409
+ * @overload log_path=(path)
412
410
  */
413
411
  static VALUE
414
412
  rb_grn_logger_s_set_log_path (VALUE klass, VALUE path)
@@ -425,7 +423,7 @@ rb_grn_logger_s_set_log_path (VALUE klass, VALUE path)
425
423
  * groongaのデフォルトロガーがクエリログを出力するファイルのパスを返す。
426
424
  *
427
425
  * @overload query_log_path
428
- * @return [String] path ログを出力するファイルのパス
426
+ * @return [String]
429
427
  */
430
428
  static VALUE
431
429
  rb_grn_logger_s_get_query_log_path (VALUE klass)
@@ -443,14 +441,13 @@ rb_grn_logger_s_get_query_log_path (VALUE klass)
443
441
  }
444
442
 
445
443
  /*
446
- * call-seq:
447
- * Groonga::Logger.query_log_path= path
448
- *
449
444
  * groongaのデフォルトロガーがクエリログを出力するファイルの
450
445
  * パスを指定する。
451
446
  *
452
- * Groonga::Logger.registerで独自のロガーを設定している場合、
447
+ * {Groonga::Logger.register} で独自のロガーを設定している場合、
453
448
  * 設定している独自ロガーは無効になる。
449
+ *
450
+ * @overload query_log_path=(path)
454
451
  */
455
452
  static VALUE
456
453
  rb_grn_logger_s_set_query_log_path (VALUE klass, VALUE path)
@@ -20,7 +20,7 @@
20
20
  * Document-class: Groonga::Object
21
21
  *
22
22
  * rroongaが提供するクラスのベースとなるクラス。
23
- * Groonga::ContextとGroonga::Logger以外はGroonga::Objectを継
23
+ * {Groonga::Context} {Groonga::Logger} 以外はGroonga::Objectを継
24
24
  * 承している。
25
25
  */
26
26
 
@@ -559,13 +559,10 @@ rb_grn_object_deconstruct (RbGrnObject *rb_grn_object,
559
559
  }
560
560
 
561
561
  /*
562
- * Document-method: close
563
- *
564
- * call-seq:
565
- * object.close
566
- *
567
562
  * _object_ が使用しているリソースを開放する。これ以降 _object_ を
568
563
  * 使うことはできない。
564
+ *
565
+ * @overload close
569
566
  */
570
567
  VALUE
571
568
  rb_grn_object_close (VALUE self)
@@ -586,12 +583,9 @@ rb_grn_object_close (VALUE self)
586
583
  }
587
584
 
588
585
  /*
589
- * Document-method: unlink
590
- *
591
- * call-seq:
592
- * object.unlink
593
- *
594
586
  * _object_ のリファレンスカウンタを1減少する。
587
+ *
588
+ * @overload unlink
595
589
  */
596
590
  VALUE
597
591
  rb_grn_object_unlink (VALUE self)
@@ -614,13 +608,10 @@ rb_grn_object_unlink (VALUE self)
614
608
  }
615
609
 
616
610
  /*
617
- * Document-method: closed?
618
- *
619
- * call-seq:
620
- * object.closed? -> true/false
621
- *
622
- * _object_ が開放済みの場合は+true+を返し、そうでない場合は
611
+ * _object_ が開放済みの場合は +true+ を返し、そうでない場合は
623
612
  * +false+ を返す。
613
+ *
614
+ * @overload closed?
624
615
  */
625
616
  VALUE
626
617
  rb_grn_object_closed_p (VALUE self)
@@ -964,12 +955,10 @@ rb_grn_object_inspect_footer (VALUE self, VALUE inspected)
964
955
  }
965
956
 
966
957
  /*
967
- * Document-method: inspect
968
- *
969
- * call-seq:
970
- * object.inspect -> 詳細情報
971
- *
972
958
  * _object_ の詳細を示した文字列を返す。デバッグ用。
959
+ *
960
+ * @overload inspect
961
+ * @return [詳細情報]
973
962
  */
974
963
  static VALUE
975
964
  rb_grn_object_inspect (VALUE self)
@@ -985,13 +974,11 @@ rb_grn_object_inspect (VALUE self)
985
974
  }
986
975
 
987
976
  /*
988
- * Document-method: id
977
+ * _object_ のIDを返す。
978
+ * _object_ が {#closed?} なときやIDがない場合は +nil+ を返す。
989
979
  *
990
- * call-seq:
991
- * object.id -> ID/nil
992
- *
993
- * _object_ のIDを返す。 _object_ が#closed?なときやIDがない場合
994
- * は +nil+ を返す。
980
+ * @overload id
981
+ * @return [ID or nil]
995
982
  */
996
983
  VALUE
997
984
  rb_grn_object_get_id (VALUE self)
@@ -1011,13 +998,11 @@ rb_grn_object_get_id (VALUE self)
1011
998
  }
1012
999
 
1013
1000
  /*
1014
- * Document-method: path
1015
- *
1016
- * call-seq:
1017
- * object.path -> ファイルパス/nil
1018
- *
1019
1001
  * _object_ に対応するファイルパスを返す。一時 _object_
1020
1002
  * なら +nil+ を返す。
1003
+ *
1004
+ * @overload path
1005
+ * @return [ファイルパス or nil]
1021
1006
  */
1022
1007
  static VALUE
1023
1008
  rb_grn_object_get_path (VALUE self)
@@ -1038,13 +1023,10 @@ rb_grn_object_get_path (VALUE self)
1038
1023
  }
1039
1024
 
1040
1025
  /*
1041
- * Document-method: temporary?
1042
- *
1043
- * call-seq:
1044
- * object.temporary? -> true/false
1045
- *
1046
1026
  * _object_ が一時オブジェクトなら +true+ 、永続オブジェクトな
1047
1027
  * ら +false+ を返す。
1028
+ *
1029
+ * @overload temporary?
1048
1030
  */
1049
1031
  static VALUE
1050
1032
  rb_grn_object_temporary_p (VALUE self)
@@ -1059,13 +1041,10 @@ rb_grn_object_temporary_p (VALUE self)
1059
1041
  }
1060
1042
 
1061
1043
  /*
1062
- * Document-method: persistent?
1063
- *
1064
- * call-seq:
1065
- * object.persistent? -> true/false
1066
- *
1067
1044
  * _object_ が永続オブジェクトなら +true+ 、一時オブジェクトな
1068
1045
  * ら +false+ を返す。
1046
+ *
1047
+ * @overload persistent?
1069
1048
  */
1070
1049
  static VALUE
1071
1050
  rb_grn_object_persistent_p (VALUE self)
@@ -1080,14 +1059,12 @@ rb_grn_object_persistent_p (VALUE self)
1080
1059
  }
1081
1060
 
1082
1061
  /*
1083
- * Document-method: domain
1084
- *
1085
- * call-seq:
1086
- * object.domain -> Groonga::Object/nil
1062
+ * _object_ の属している {Groonga::Object} を返す。例えば、
1063
+ * {Groonga::Column} は {Groonga::Table} を返す。属している
1064
+ * {Groonga::Object} がない場合は +nil+ を返す。
1087
1065
  *
1088
- * _object_ の属しているGroonga::Objectを返す。例えば、
1089
- * Groonga::ColumnはGroonga::Tableを返す。属している
1090
- * Groonga::Objectがない場合は +nil+ を返す。
1066
+ * @overload domain
1067
+ * @return [Groonga::Object or nil]
1091
1068
  */
1092
1069
  static VALUE
1093
1070
  rb_grn_object_get_domain (VALUE self)
@@ -1118,12 +1095,10 @@ rb_grn_object_get_domain (VALUE self)
1118
1095
  }
1119
1096
 
1120
1097
  /*
1121
- * Document-method: name
1122
- *
1123
- * call-seq:
1124
- * object.name -> 名前/nil
1125
- *
1126
1098
  * _object_ の名前を返す。無名オブジェクトの場合は +nil+ を返す。
1099
+ *
1100
+ * @overload name
1101
+ * @return [名前 or nil]
1127
1102
  */
1128
1103
  static VALUE
1129
1104
  rb_grn_object_get_name (VALUE self)
@@ -1152,16 +1127,14 @@ rb_grn_object_get_name (VALUE self)
1152
1127
  }
1153
1128
 
1154
1129
  /*
1155
- * Document-method: range
1156
- *
1157
- * call-seq:
1158
- * object.range -> Groonga::Object/nil
1159
- *
1160
- * _object_ の値がとりうる範囲を示したGroonga::Objectを返す。
1161
- * 例えば、Groonga::Columnの場合は
1162
- * Groonga::Table#define_columnで指定されたGroonga::Typeや
1163
- * Groonga::Tableを返す。
1130
+ * _object_ の値がとりうる範囲を示した {Groonga::Object} を返す。
1131
+ * 例えば、 {Groonga::Column} の場合は
1132
+ * {Groonga::Table#define_column} で指定された {Groonga::Type} や
1133
+ * {Groonga::Table} を返す。
1164
1134
  * 範囲が指定されていないオブジェクトの場合は +nil+ を返す。
1135
+ *
1136
+ * @overload range
1137
+ * @return [Groonga::Object or nil]
1165
1138
  */
1166
1139
  static VALUE
1167
1140
  rb_grn_object_get_range (VALUE self)
@@ -1192,13 +1165,11 @@ rb_grn_object_get_range (VALUE self)
1192
1165
  }
1193
1166
 
1194
1167
  /*
1195
- * Document-method: ==
1196
- *
1197
- * call-seq:
1198
- * object == other -> true/false
1199
- *
1200
1168
  * _object_ と _other_ が同じgroongaのオブジェクトなら +true+ を返
1201
1169
  * し、そうでなければ +false+ を返す。
1170
+ *
1171
+ * @overload ==(other)
1172
+ * @return [Boolean]
1202
1173
  */
1203
1174
  static VALUE
1204
1175
  rb_grn_object_equal (VALUE self, VALUE other)
@@ -1219,12 +1190,10 @@ rb_grn_object_equal (VALUE self, VALUE other)
1219
1190
  }
1220
1191
 
1221
1192
  /*
1222
- * Document-method: []
1223
- *
1224
- * call-seq:
1225
- * object[id] -> 値
1226
- *
1227
1193
  * _object_ の _id_ に対応する値を返す。
1194
+ *
1195
+ * @overload [](id)
1196
+ * @return [値]
1228
1197
  */
1229
1198
  VALUE
1230
1199
  rb_grn_object_array_reference (VALUE self, VALUE rb_id)
@@ -1382,13 +1351,10 @@ rb_grn_object_set (VALUE self, VALUE rb_id, VALUE rb_value, int flags)
1382
1351
  }
1383
1352
 
1384
1353
  /*
1385
- * Document-method: []=
1386
- *
1387
- * call-seq:
1388
- * object[id] = value
1389
- *
1390
1354
  * _object_ の _id_ に対応する値を設定する。既存の値は上書きさ
1391
1355
  * れる。
1356
+ *
1357
+ * @overload []=(id, value)
1392
1358
  */
1393
1359
  static VALUE
1394
1360
  rb_grn_object_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
@@ -1397,12 +1363,9 @@ rb_grn_object_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
1397
1363
  }
1398
1364
 
1399
1365
  /*
1400
- * Document-method: append
1401
- *
1402
- * call-seq:
1403
- * object.append(id, value)
1404
- *
1405
1366
  * _object_ の _id_ に対応する値の最後に _value_ を追加する。
1367
+ *
1368
+ * @overload append(id, value)
1406
1369
  */
1407
1370
  static VALUE
1408
1371
  rb_grn_object_append_value (VALUE self, VALUE rb_id, VALUE rb_value)
@@ -1411,12 +1374,9 @@ rb_grn_object_append_value (VALUE self, VALUE rb_id, VALUE rb_value)
1411
1374
  }
1412
1375
 
1413
1376
  /*
1414
- * Document-method: prepend
1415
- *
1416
- * call-seq:
1417
- * object.prepend(id, value)
1418
- *
1419
1377
  * _object_ の _id_ に対応する値の最初に _value_ を追加する。
1378
+ *
1379
+ * @overload prepend(id, value)
1420
1380
  */
1421
1381
  static VALUE
1422
1382
  rb_grn_object_prepend_value (VALUE self, VALUE rb_id, VALUE rb_value)
@@ -1425,13 +1385,10 @@ rb_grn_object_prepend_value (VALUE self, VALUE rb_id, VALUE rb_value)
1425
1385
  }
1426
1386
 
1427
1387
  /*
1428
- * Document-method: remove
1429
- *
1430
- * call-seq:
1431
- * object.remove
1432
- *
1433
1388
  * _object_ をメモリから解放し、それが永続オブジェクトであっ
1434
1389
  * た場合は、該当するファイル一式を削除する。
1390
+ *
1391
+ * @overload remove
1435
1392
  */
1436
1393
  static VALUE
1437
1394
  rb_grn_object_remove (VALUE self)