rroonga 2.0.4 → 2.0.5

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 (90) hide show
  1. data/Rakefile +21 -2
  2. data/bin/grndump +3 -2
  3. data/ext/groonga/extconf.rb +1 -6
  4. data/ext/groonga/rb-grn-array.c +58 -31
  5. data/ext/groonga/rb-grn-column.c +220 -148
  6. data/ext/groonga/rb-grn-context.c +46 -32
  7. data/ext/groonga/rb-grn-database.c +102 -90
  8. data/ext/groonga/rb-grn-double-array-trie.c +205 -163
  9. data/ext/groonga/rb-grn-encoding-support.c +2 -3
  10. data/ext/groonga/rb-grn-encoding.c +13 -8
  11. data/ext/groonga/rb-grn-exception.c +1 -1
  12. data/ext/groonga/rb-grn-expression.c +110 -133
  13. data/ext/groonga/rb-grn-fix-size-column.c +5 -4
  14. data/ext/groonga/rb-grn-geo-point.c +55 -0
  15. data/ext/groonga/rb-grn-hash.c +120 -82
  16. data/ext/groonga/rb-grn-index-column.c +66 -70
  17. data/ext/groonga/rb-grn-index-cursor.c +3 -0
  18. data/ext/groonga/rb-grn-logger.c +33 -51
  19. data/ext/groonga/rb-grn-object.c +2 -0
  20. data/ext/groonga/rb-grn-operator.c +1 -1
  21. data/ext/groonga/rb-grn-patricia-trie.c +287 -232
  22. data/ext/groonga/rb-grn-plugin.c +11 -14
  23. data/ext/groonga/rb-grn-snippet.c +37 -54
  24. data/ext/groonga/rb-grn-table-cursor-key-support.c +3 -3
  25. data/ext/groonga/rb-grn-table-cursor.c +8 -6
  26. data/ext/groonga/rb-grn-table-key-support.c +22 -29
  27. data/ext/groonga/rb-grn-table.c +355 -279
  28. data/ext/groonga/rb-grn-type.c +18 -25
  29. data/ext/groonga/rb-grn-utils.c +77 -7
  30. data/ext/groonga/rb-grn-variable-size-column.c +12 -20
  31. data/ext/groonga/rb-grn-view.c +56 -51
  32. data/ext/groonga/rb-grn.h +28 -1
  33. data/ext/groonga/rb-groonga.c +1 -0
  34. data/lib/groonga.rb +2 -0
  35. data/lib/groonga/command.rb +3 -1
  36. data/lib/groonga/database.rb +27 -0
  37. data/lib/groonga/dumper.rb +96 -17
  38. data/lib/groonga/geo-point.rb +216 -0
  39. data/lib/groonga/schema.rb +29 -46
  40. data/rroonga-build.rb +1 -1
  41. data/rroonga.gemspec +90 -0
  42. data/test/groonga-test-utils.rb +168 -0
  43. data/test/run-test.rb +60 -0
  44. data/test/test-accessor.rb +36 -0
  45. data/test/test-array.rb +146 -0
  46. data/test/test-column.rb +350 -0
  47. data/test/test-command-select.rb +181 -0
  48. data/test/test-context.rb +130 -0
  49. data/test/test-database-dumper.rb +259 -0
  50. data/test/test-database.rb +173 -0
  51. data/test/test-double-array-trie.rb +189 -0
  52. data/test/test-encoding.rb +33 -0
  53. data/test/test-exception.rb +230 -0
  54. data/test/test-expression-builder.rb +602 -0
  55. data/test/test-expression.rb +134 -0
  56. data/test/test-fix-size-column.rb +77 -0
  57. data/test/test-geo-point.rb +190 -0
  58. data/test/test-gqtp.rb +70 -0
  59. data/test/test-hash.rb +367 -0
  60. data/test/test-index-column.rb +180 -0
  61. data/test/test-index-cursor.rb +123 -0
  62. data/test/test-logger.rb +37 -0
  63. data/test/test-pagination.rb +249 -0
  64. data/test/test-patricia-trie.rb +440 -0
  65. data/test/test-plugin.rb +35 -0
  66. data/test/test-procedure.rb +37 -0
  67. data/test/test-query-log.rb +258 -0
  68. data/test/test-record.rb +577 -0
  69. data/test/test-remote.rb +63 -0
  70. data/test/test-schema-create-table.rb +267 -0
  71. data/test/test-schema-dumper.rb +235 -0
  72. data/test/test-schema-type.rb +208 -0
  73. data/test/test-schema-view.rb +90 -0
  74. data/test/test-schema.rb +886 -0
  75. data/test/test-snippet.rb +130 -0
  76. data/test/test-table-dumper.rb +353 -0
  77. data/test/test-table-offset-and-limit.rb +100 -0
  78. data/test/test-table-select-mecab.rb +80 -0
  79. data/test/test-table-select-normalize.rb +57 -0
  80. data/test/test-table-select-weight.rb +123 -0
  81. data/test/test-table-select.rb +191 -0
  82. data/test/test-table-traverse.rb +304 -0
  83. data/test/test-table.rb +711 -0
  84. data/test/test-type.rb +79 -0
  85. data/test/test-variable-size-column.rb +147 -0
  86. data/test/test-variable.rb +28 -0
  87. data/test/test-vector-column.rb +76 -0
  88. data/test/test-version.rb +61 -0
  89. data/test/test-view.rb +72 -0
  90. metadata +330 -202
@@ -49,32 +49,25 @@ rb_grn_type_to_ruby_object (grn_ctx *context, grn_obj *type,
49
49
  }
50
50
 
51
51
  /*
52
- * call-seq:
53
- * Groonga::Type.new(name, options={})
52
+ * 名前が _name_ の型を作成する。
54
53
  *
55
- * 名前が _name_ の型を作成する。 _options_ に指定可能な値は以下の通
56
- * り。
57
- * @param options [::Hash] The name and value
58
- * pairs. Omitted names are initialized as the default value
59
- * @option options :type (variable) The type
60
- *
61
- * :integer(符号付き整数)、:int(:integerの省略
62
- * 形)、:unsigned_integer(符号なし整
63
- * 数)、:uint(:unsigned_integerの省略形)、:float(浮動小
64
- * 数点数)、:variable(可変長文字列)のいずれかを指定する。
65
- * 省略した場合は:variableを指定したものと扱う。
66
- *
67
- * :variableを指定した場合は必ず +:size+ を指定しなければいけない。
68
- *
69
- * @option options :context The context
70
- *
71
- * 型の作成時に利用するGroonga::Contextを指定する。省略すると
72
- * Groonga::Context.defaultを用いる。
73
- *
74
- * @option options :size The size
75
- *
76
- * +:option+ が:variableの場合は最大長、それ以外の場合は長さを
77
- * 指定する(単位:byte)。
54
+ * @overload new(name, options={})
55
+ * @param name [String] 作成する型の名前
56
+ * @param options [::Hash] The name and value
57
+ * pairs. Omitted names are initialized as the default value
58
+ * @option options [Symbol] :type (:variable)
59
+ * :integer(符号付き整数)、:int(:integerの省略
60
+ * 形)、:unsigned_integer(符号なし整
61
+ * 数)、:uint(:unsigned_integerの省略形)、:float(浮動小数点
62
+ * 数)、:variable(可変長文字列)のいずれかを指定する。省略した場
63
+ * 合は:variableを指定したものと扱う。
64
+ * :variableを指定した場合は必ず +:size+ を指定しなければいけない。
65
+ * @option options [Context] :context
66
+ * 型の作成時に利用するGroonga::Contextを指定する。省略すると
67
+ * Groonga::Context.defaultを用いる。
68
+ * @option options [Integer] :size
69
+ * +:option+ が:variableの場合は最大長、それ以外の場合は長さを
70
+ * 指定する(単位:byte)。
78
71
  */
79
72
  static VALUE
80
73
  rb_grn_type_initialize (int argc, VALUE *argv, VALUE self)
@@ -106,7 +106,13 @@ rb_grn_scan_options (VALUE options, ...)
106
106
 
107
107
  options = rb_check_convert_type(options, T_HASH, "Hash", "to_hash");
108
108
  if (NIL_P(options)) {
109
- options = rb_hash_new();
109
+ if (NIL_P(original_options)) {
110
+ options = rb_hash_new();
111
+ } else {
112
+ rb_raise(rb_eArgError,
113
+ "options must be Hash: %s",
114
+ rb_grn_inspect(original_options));
115
+ }
110
116
  } else if (options == original_options) {
111
117
  options = rb_funcall(options, rb_intern("dup"), 0);
112
118
  }
@@ -197,6 +203,22 @@ rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
197
203
  GRN_TEXT_VALUE(bulk),
198
204
  GRN_TEXT_LEN(bulk));
199
205
  break;
206
+ case GRN_DB_TOKYO_GEO_POINT:
207
+ {
208
+ int latitude, longitude;
209
+
210
+ GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
211
+ *rb_value = rb_grn_tokyo_geo_point_new(latitude, longitude);
212
+ }
213
+ break;
214
+ case GRN_DB_WGS84_GEO_POINT:
215
+ {
216
+ int latitude, longitude;
217
+
218
+ GRN_GEO_POINT_VALUE(bulk, latitude, longitude);
219
+ *rb_value = rb_grn_wgs84_geo_point_new(latitude, longitude);
220
+ }
221
+ break;
200
222
  default:
201
223
  success = GRN_FALSE;
202
224
  break;
@@ -297,9 +319,9 @@ grn_obj *
297
319
  rb_grn_bulk_from_ruby_object (VALUE object, grn_ctx *context, grn_obj *bulk)
298
320
  {
299
321
  if (bulk && bulk->header.domain == GRN_DB_TIME)
300
- return rb_grn_bulk_from_ruby_object_with_type(
301
- object, context, bulk, bulk->header.domain,
302
- grn_ctx_at(context, bulk->header.domain));
322
+ return RVAL2GRNBULK_WITH_TYPE(object, context, bulk,
323
+ bulk->header.domain,
324
+ grn_ctx_at(context, bulk->header.domain));
303
325
 
304
326
  if (!bulk) {
305
327
  bulk = grn_obj_open(context, GRN_BULK, 0, GRN_ID_NIL);
@@ -398,6 +420,7 @@ rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
398
420
  uint64_t uint64_value;
399
421
  int64_t time_value;
400
422
  double double_value;
423
+ grn_geo_point geo_point_value;
401
424
  grn_id record_id, range;
402
425
  VALUE rb_type_object;
403
426
  grn_obj_flags flags = 0;
@@ -406,9 +429,6 @@ rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
406
429
  string_p = rb_type(object) == T_STRING;
407
430
  table_type_p = (GRN_TABLE_HASH_KEY <= type->header.type &&
408
431
  type->header.type <= GRN_TABLE_VIEW);
409
- if (string_p && !table_type_p) {
410
- return RVAL2GRNBULK(object, context, bulk);
411
- }
412
432
 
413
433
  switch (type_id) {
414
434
  case GRN_DB_INT32:
@@ -483,6 +503,27 @@ rb_grn_bulk_from_ruby_object_with_type (VALUE object, grn_ctx *context,
483
503
  size, range);
484
504
  flags |= GRN_OBJ_DO_SHALLOW_COPY;
485
505
  break;
506
+ case GRN_DB_TOKYO_GEO_POINT:
507
+ case GRN_DB_WGS84_GEO_POINT:
508
+ {
509
+ VALUE rb_geo_point;
510
+ VALUE rb_latitude, rb_longitude;
511
+ if (type_id == GRN_DB_TOKYO_GEO_POINT) {
512
+ rb_geo_point = rb_funcall(rb_cGrnTokyoGeoPoint,
513
+ rb_intern("new"), 1, object);
514
+ } else {
515
+ rb_geo_point = rb_funcall(rb_cGrnWGS84GeoPoint,
516
+ rb_intern("new"), 1, object);
517
+ }
518
+ rb_geo_point = rb_funcall(rb_geo_point, rb_intern("to_msec"), 0);
519
+ rb_latitude = rb_funcall(rb_geo_point, rb_intern("latitude"), 0);
520
+ rb_longitude = rb_funcall(rb_geo_point, rb_intern("longitude"), 0);
521
+ geo_point_value.latitude = NUM2INT(rb_latitude);
522
+ geo_point_value.longitude = NUM2INT(rb_longitude);
523
+ string = (const char *)&geo_point_value;
524
+ size = sizeof(geo_point_value);
525
+ }
526
+ break;
486
527
  case GRN_DB_VOID:
487
528
  case GRN_DB_DELIMIT:
488
529
  case GRN_DB_UNIGRAM:
@@ -785,6 +826,35 @@ rb_grn_key_from_ruby_object (VALUE rb_key, grn_ctx *context,
785
826
  return key;
786
827
  }
787
828
 
829
+ grn_obj *
830
+ rb_grn_value_from_ruby_object (VALUE object, grn_ctx *context,
831
+ grn_obj *value, grn_id type_id, grn_obj *type)
832
+ {
833
+ grn_bool string_p, table_type_p;
834
+
835
+ string_p = rb_type(object) == T_STRING;
836
+ table_type_p = (GRN_TABLE_HASH_KEY <= type->header.type &&
837
+ type->header.type <= GRN_TABLE_VIEW);
838
+ if (!string_p) {
839
+ return RVAL2GRNBULK_WITH_TYPE(object, context, value, type_id, type);
840
+ }
841
+
842
+ if (table_type_p && RSTRING_LEN(object) == 0) {
843
+ if (value) {
844
+ if (value->header.domain != type_id) {
845
+ grn_obj_reinit(context, value, type_id, 0);
846
+ }
847
+ } else {
848
+ value = grn_obj_open(context, GRN_BULK, 0, type_id);
849
+ rb_grn_context_check(context, object);
850
+ }
851
+ GRN_RECORD_SET(context, value, GRN_ID_NIL);
852
+ return value;
853
+ }
854
+
855
+ return RVAL2GRNBULK(object, context, value);
856
+ }
857
+
788
858
  grn_obj *
789
859
  rb_grn_obj_from_ruby_object (VALUE rb_object, grn_ctx *context, grn_obj **_obj)
790
860
  {
@@ -29,20 +29,14 @@ VALUE rb_cGrnVariableSizeColumn;
29
29
  */
30
30
 
31
31
  /*
32
- * Document-method: compressed?
33
- *
34
- * call-seq:
35
- * column.compressed? -> boolean
36
- * column.compressed?(type) -> boolean
37
- *
38
32
  * Returns whether the column is compressed or not. If
39
33
  * @type@ is specified, it returns whether the column is
40
34
  * compressed by @type@ or not.
41
- *
42
- * @return [Boolean] whether the column is compressed or not.
43
- * @param [:zlib, :lzo] type (nil) If @type@ isn't @nil@,
44
- * it checks whether specified compressed type is used or
45
- * not.
35
+ * @overload compressed?
36
+ * @return [Boolean] whether the column is compressed or not.
37
+ * @overload compressed?(type)
38
+ * @param [:zlib, :lzo] type (nil)
39
+ * @return [Boolean] whether specified compressed type is used or not.
46
40
  * @since 1.3.1
47
41
  */
48
42
  static VALUE
@@ -103,18 +97,16 @@ rb_grn_variable_size_column_compressed_p (int argc, VALUE *argv, VALUE self)
103
97
  }
104
98
 
105
99
  /*
106
- * Document-method: defrag
107
- *
108
- * call-seq:
109
- * column.defrag(options={}) -> n_segments
110
- *
111
100
  * Defrags the column.
112
101
  *
102
+ * @overload defrag(options={})
103
+ * @param options [::Hash] The name and value
104
+ * pairs. Omitted names are initialized as the default value.
105
+ * @option options [Integer] :threshold (0) the threshold to
106
+ * determine whether a segment is defraged. Available
107
+ * values are -4..22. -4 means all segments are defraged.
108
+ * 22 means no segment is defraged.
113
109
  * @return [Integer] the number of defraged segments
114
- * @option options [Integer] :threshold (0) the threshold to
115
- * determine whether a segment is defraged. Available
116
- * values are -4..22. -4 means all segments are defraged.
117
- * 22 means no segment is defraged.
118
110
  * @since 1.2.6
119
111
  */
120
112
  static VALUE
@@ -35,10 +35,6 @@ VALUE rb_cGrnView;
35
35
  */
36
36
 
37
37
  /*
38
- * call-seq:
39
- * Groonga::View.create(options={}) -> Groonga::View
40
- * Groonga::View.create(options={}) {|table| ... }
41
- *
42
38
  * 複数のテーブルを1つのテーブルとして扱う仮想的なテーブル
43
39
  * (ビュー)を生成する。ブロックを指定すると、そのブロック
44
40
  * に生成したテーブルが渡され、ブロックを抜けると自動的にテー
@@ -47,54 +43,63 @@ VALUE rb_cGrnView;
47
43
  * ビューにテーブルを追加するときはGroonga::View#add_tableを
48
44
  * 使う。
49
45
  *
50
- * _options_ に指定可能な値は以下の通り。
51
- * @param options [::Hash] The name and value
52
- * pairs. Omitted names are initialized as the default value
53
- * @option options :context (Groonga::Context.default)
54
- *
55
- * ビューが利用するGroonga::Context。
56
- *
57
- * @option options :name The view name
58
- *
59
- * ビューの名前。名前をつけると、Groonga::Context#[]に名
60
- * 前を指定してビューを取得することができる。省略すると
61
- * 無名ビューになり、ビューIDでのみ取得できる。
46
+ * @example 無名一時ビューを生成する。
47
+ * Groonga::View.create
62
48
  *
63
- * @option options :path The path
49
+ * @example 無名永続ビューを生成する。
50
+ * Groonga::View.create(:path => "/tmp/view.grn")
64
51
  *
65
- * ビューを保存するパス。パスを指定すると永続ビューとな
66
- * り、プロセス終了後もレコードは保持される。次回起動時に
67
- * Groonga::View.openで保存されたビューを利用することが
68
- * できる。省略すると一時ビューになり、プロセスが終了する
69
- * とビューは破棄される。
52
+ * @example 名前付き永続ビューを生成する。ただし、ファイル名は気にしない。
53
+ * Groonga::View.create(:name => "Entries",
54
+ * :persistent => true)
70
55
  *
71
- * @option options :persistent The persistent
72
- *
73
- * +true+ を指定すると永続ビューとなる。 +path+ を省略した
74
- * 場合は自動的にパスが付加される。 +:context+ で指定した
75
- * Groonga::Contextに結びついているデータベースが一時デー
76
- * タベースの場合は例外が発生する。
77
- *
78
- * @example
79
- * 無名一時ビューを生成する。
80
- * Groonga::View.create
81
- *
82
- * @example
83
- * 無名永続ビューを生成する。
84
- * Groonga::View.create(:path => "/tmp/view.grn")
85
- *
86
- * @example
87
- * 名前付き永続ビューを生成する。ただし、ファイル名は気に
88
- * しない。
89
- * Groonga::View.create(:name => "Entries",
90
- * :persistent => true)
91
- *
92
- * @example
93
- * +Users+ テーブルと +Dogs+ テーブルを横断検索するための
94
- * るビューを生成する。
56
+ * @example +Users+ テーブルと +Dogs+ テーブルを横断検索するためのビューを生成する。
95
57
  * entries = Groonga::View.create(:name => "Entries")
96
58
  * entries.add_table("Users")
97
59
  * entries.add_table("Dogs")
60
+ *
61
+ * @overload create(options={})
62
+ * @return [Groonga::View]
63
+ * @param options [::Hash] The name and value
64
+ * pairs. Omitted names are initialized as the default value
65
+ * @option options :context (Groonga::Context.default)
66
+ * ビューが利用するGroonga::Context。
67
+ * @option options :name
68
+ * ビューの名前。名前をつけると、Groonga::Context#[]に名
69
+ * 前を指定してビューを取得することができる。省略すると
70
+ * 無名ビューになり、ビューIDでのみ取得できる。
71
+ * @option options :path
72
+ * ビューを保存するパス。パスを指定すると永続ビューとな
73
+ * り、プロセス終了後もレコードは保持される。次回起動時に
74
+ * Groonga::View.openで保存されたビューを利用することが
75
+ * できる。省略すると一時ビューになり、プロセスが終了する
76
+ * とビューは破棄される。
77
+ * @option options :persistent
78
+ * +true+ を指定すると永続ビューとなる。 +path+ を省略した
79
+ * 場合は自動的にパスが付加される。 +:context+ で指定した
80
+ * Groonga::Contextに結びついているデータベースが一時デー
81
+ * タベースの場合は例外が発生する。
82
+ * @overload create(options={})
83
+ * @yield [table]
84
+ * @param options [::Hash] The name and value
85
+ * pairs. Omitted names are initialized as the default value
86
+ * @option options :context (Groonga::Context.default)
87
+ * ビューが利用するGroonga::Context。
88
+ * @option options :name
89
+ * ビューの名前。名前をつけると、Groonga::Context#[]に名
90
+ * 前を指定してビューを取得することができる。省略すると
91
+ * 無名ビューになり、ビューIDでのみ取得できる。
92
+ * @option options :path
93
+ * ビューを保存するパス。パスを指定すると永続ビューとな
94
+ * り、プロセス終了後もレコードは保持される。次回起動時に
95
+ * Groonga::View.openで保存されたビューを利用することが
96
+ * できる。省略すると一時ビューになり、プロセスが終了する
97
+ * とビューは破棄される。
98
+ * @option options :persistent
99
+ * +true+ を指定すると永続ビューとなる。 +path+ を省略した
100
+ * 場合は自動的にパスが付加される。 +:context+ で指定した
101
+ * Groonga::Contextに結びついているデータベースが一時デー
102
+ * タベースの場合は例外が発生する。
98
103
  */
99
104
  static VALUE
100
105
  rb_grn_view_s_create (int argc, VALUE *argv, VALUE klass)
@@ -219,12 +224,12 @@ rb_grn_view_each (VALUE self)
219
224
  }
220
225
 
221
226
  /*
222
- * Document-method: column_value
223
- *
224
- * call-seq:
225
- * view.column_value(id, name) -> 値
227
+ * _view_ の _id_ に対応するカラム _name_ のもつ値を返す。
226
228
  *
227
- * _view_ _id_ に対応するカラム _name_ の値を返す。
229
+ * @overload column_value(id, name)
230
+ * @param [String] id _view_ のもつ _id_
231
+ * @param [String] name _id_ に対応するカラム名
232
+ * @return カラム _name_ のもつ値
228
233
  */
229
234
  static VALUE
230
235
  rb_grn_view_get_column_value (VALUE self, VALUE rb_id, VALUE rb_name)
data/ext/groonga/rb-grn.h CHANGED
@@ -28,6 +28,10 @@
28
28
  # include <ruby/intern.h>
29
29
  #endif
30
30
 
31
+ #ifndef RETURN_ENUMERATOR
32
+ # define RETURN_ENUMERATOR(obj, argc, argv)
33
+ #endif
34
+
31
35
  #include <groonga.h>
32
36
 
33
37
  #if defined(__cplusplus)
@@ -72,7 +76,7 @@ RB_GRN_BEGIN_DECLS
72
76
 
73
77
  #define RB_GRN_MAJOR_VERSION 2
74
78
  #define RB_GRN_MINOR_VERSION 0
75
- #define RB_GRN_MICRO_VERSION 4
79
+ #define RB_GRN_MICRO_VERSION 5
76
80
 
77
81
  #define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
78
82
 
@@ -235,6 +239,9 @@ RB_GRN_VAR VALUE rb_cGrnIndexColumn;
235
239
  RB_GRN_VAR VALUE rb_cGrnIndexCursor;
236
240
  RB_GRN_VAR VALUE rb_cGrnAccessor;
237
241
  RB_GRN_VAR VALUE rb_cGrnViewAccessor;
242
+ RB_GRN_VAR VALUE rb_cGrnGeoPoint;
243
+ RB_GRN_VAR VALUE rb_cGrnTokyoGeoPoint;
244
+ RB_GRN_VAR VALUE rb_cGrnWGS84GeoPoint;
238
245
  RB_GRN_VAR VALUE rb_cGrnRecord;
239
246
  RB_GRN_VAR VALUE rb_cGrnViewRecord;
240
247
  RB_GRN_VAR VALUE rb_cGrnLogger;
@@ -277,6 +284,7 @@ void rb_grn_init_index_cursor (VALUE mGrn);
277
284
  void rb_grn_init_posting (VALUE mGrn);
278
285
  void rb_grn_init_accessor (VALUE mGrn);
279
286
  void rb_grn_init_view_accessor (VALUE mGrn);
287
+ void rb_grn_init_geo_point (VALUE mGrn);
280
288
  void rb_grn_init_record (VALUE mGrn);
281
289
  void rb_grn_init_view_record (VALUE mGrn);
282
290
  void rb_grn_init_variable (VALUE mGrn);
@@ -497,6 +505,15 @@ void rb_grn_expression_finalizer (grn_ctx *context,
497
505
  VALUE rb_grn_posting_new (grn_posting *posting,
498
506
  grn_id term_id);
499
507
 
508
+ VALUE rb_grn_tokyo_geo_point_new (int latitude,
509
+ int longitude);
510
+ VALUE rb_grn_wgs84_geo_point_new (int latitude,
511
+ int longitude);
512
+ VALUE rb_grn_tokyo_geo_point_new_raw (VALUE latitude,
513
+ VALUE longitude);
514
+ VALUE rb_grn_wgs84_geo_point_new_raw (VALUE latitude,
515
+ VALUE longitude);
516
+
500
517
  VALUE rb_grn_record_new (VALUE table,
501
518
  grn_id id,
502
519
  VALUE values);
@@ -606,6 +623,9 @@ VALUE rb_grn_column_expression_builder_build
606
623
  (rb_grn_key_from_ruby_object(object, context, key, domain_id, \
607
624
  domain, related_object))
608
625
 
626
+ #define RVAL2GRNVALUE(object, context, key, domain_id, domain) \
627
+ (rb_grn_value_from_ruby_object(object, context, key, domain_id, domain))
628
+
609
629
  #define GRNVARIABLE2RVAL(context, variable) \
610
630
  (rb_grn_variable_to_ruby_object(context, variable))
611
631
  #define RVAL2GRNVARIABLE(object, context) \
@@ -617,6 +637,8 @@ grn_encoding rb_grn_encoding_from_ruby_object (VALUE object,
617
637
  VALUE rb_grn_encoding_to_ruby_object (grn_encoding encoding);
618
638
  #ifdef HAVE_RUBY_ENCODING_H
619
639
  rb_encoding *rb_grn_encoding_to_ruby_encoding (grn_encoding encoding);
640
+ VALUE rb_grn_encoding_to_ruby_encoding_object
641
+ (grn_encoding encoding);
620
642
  #endif
621
643
 
622
644
  grn_ctx *rb_grn_context_from_ruby_object (VALUE object);
@@ -726,6 +748,11 @@ grn_obj *rb_grn_key_from_ruby_object (VALUE rb_key,
726
748
  grn_id domain_id,
727
749
  grn_obj *domain,
728
750
  VALUE related_object);
751
+ grn_obj *rb_grn_value_from_ruby_object (VALUE rb_key,
752
+ grn_ctx *context,
753
+ grn_obj *value,
754
+ grn_id domain_id,
755
+ grn_obj *domain);
729
756
 
730
757
  VALUE rb_grn_variable_to_ruby_object (grn_ctx *context,
731
758
  grn_obj *variable);