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.
Files changed (48) hide show
  1. data/AUTHORS +5 -0
  2. data/Gemfile +20 -0
  3. data/Rakefile +187 -0
  4. data/doc/text/news.textile +10 -2
  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/rroonga-build.rb +7 -0
  42. data/rroonga.gemspec +1 -1
  43. data/test/test-hash.rb +4 -4
  44. data/test/test-index-column.rb +271 -257
  45. data/test/test-table-key-support.rb +78 -0
  46. data/test/test-table.rb +78 -51
  47. metadata +195 -164
  48. checksums.yaml +0 -7
@@ -23,7 +23,7 @@ VALUE rb_cGrnPosting;
23
23
 
24
24
  VALUE
25
25
  rb_grn_posting_new (grn_posting *posting, grn_id term_id,
26
- VALUE rb_table, VALUE rb_lexicon)
26
+ VALUE rb_table, VALUE rb_lexicon)
27
27
  {
28
28
  VALUE parameters;
29
29
 
@@ -46,7 +46,7 @@ rb_grn_posting_new (grn_posting *posting, grn_id term_id,
46
46
  rb_hash_aset(parameters, ID2SYM(rb_intern("lexicon")), rb_lexicon);
47
47
 
48
48
  return rb_funcall(rb_cGrnPosting, rb_intern("new"), 1,
49
- parameters);
49
+ parameters);
50
50
  }
51
51
 
52
52
  void
@@ -26,7 +26,7 @@ grn_obj *
26
26
  rb_grn_procedure_from_ruby_object (VALUE object)
27
27
  {
28
28
  if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnProcedure))) {
29
- rb_raise(rb_eTypeError, "not a groonga procedure");
29
+ rb_raise(rb_eTypeError, "not a groonga procedure");
30
30
  }
31
31
 
32
32
  return RVAL2GRNOBJECT(object, NULL);
@@ -34,7 +34,7 @@ rb_grn_procedure_from_ruby_object (VALUE object)
34
34
 
35
35
  VALUE
36
36
  rb_grn_procedure_to_ruby_object (grn_ctx *context, grn_obj *procedure,
37
- grn_bool owner)
37
+ grn_bool owner)
38
38
  {
39
39
  return GRNOBJECT2RVAL(rb_cGrnProcedure, context, procedure, owner);
40
40
  }
@@ -234,7 +234,7 @@ rb_grn_query_logger_s_get_path (VALUE klass)
234
234
 
235
235
  path = grn_default_query_logger_get_path();
236
236
  if (path) {
237
- rb_path = rb_str_new2(path);
237
+ rb_path = rb_str_new2(path);
238
238
  }
239
239
  return rb_path;
240
240
  }
@@ -40,7 +40,7 @@ VALUE
40
40
  rb_grn_record_new_raw (VALUE table, VALUE rb_id, VALUE values)
41
41
  {
42
42
  return rb_funcall(rb_cGrnRecord, rb_intern("new"), 3,
43
- table, rb_id, values);
43
+ table, rb_id, values);
44
44
  }
45
45
 
46
46
  void
@@ -30,28 +30,28 @@ VALUE rb_cGrnSnippet;
30
30
 
31
31
  void
32
32
  rb_grn_snippet_finalizer (grn_ctx *context, grn_obj *object,
33
- RbGrnSnippet *rb_grn_snippet)
33
+ RbGrnSnippet *rb_grn_snippet)
34
34
  {
35
35
  rb_grn_context_unregister_floating_object(RB_GRN_OBJECT(rb_grn_snippet));
36
36
  }
37
37
 
38
38
  void
39
39
  rb_grn_snippet_bind (RbGrnSnippet *rb_grn_snippet,
40
- grn_ctx *context, grn_obj *snippet)
40
+ grn_ctx *context, grn_obj *snippet)
41
41
  {
42
42
  }
43
43
 
44
44
  void
45
45
  rb_grn_snippet_deconstruct (RbGrnSnippet *rb_grn_snippet,
46
- grn_obj **snippet,
47
- grn_ctx **context)
46
+ grn_obj **snippet,
47
+ grn_ctx **context)
48
48
  {
49
49
  RbGrnObject *rb_grn_object;
50
50
 
51
51
  rb_grn_object = RB_GRN_OBJECT(rb_grn_snippet);
52
52
  rb_grn_object_deconstruct(rb_grn_object, snippet, context,
53
- NULL, NULL,
54
- NULL, NULL);
53
+ NULL, NULL,
54
+ NULL, NULL);
55
55
  }
56
56
 
57
57
  /*
@@ -112,10 +112,10 @@ rb_grn_snippet_initialize (int argc, VALUE *argv, VALUE self)
112
112
 
113
113
  context = rb_grn_context_ensure(&rb_context);
114
114
  if (!grn_ctx_db(context)) {
115
- rb_raise(rb_eArgError,
116
- "Groonga::Context should be associated with a database by "
117
- "Groonga::Database#open or #create: %s",
118
- rb_grn_inspect(rb_context));
115
+ rb_raise(rb_eArgError,
116
+ "Groonga::Context should be associated with a database by "
117
+ "Groonga::Database#open or #create: %s",
118
+ rb_grn_inspect(rb_context));
119
119
  }
120
120
 
121
121
  if (RVAL2CBOOL(rb_normalize))
@@ -234,9 +234,9 @@ rb_grn_snippet_execute (VALUE self, VALUE rb_string)
234
234
  rb_grn_snippet_deconstruct(SELF(self), &snippet, &context);
235
235
 
236
236
  if (TYPE(rb_string) != T_STRING) {
237
- rb_raise(rb_eGrnInvalidArgument,
238
- "snippet text must be String: <%s>",
239
- rb_grn_inspect(rb_string));
237
+ rb_raise(rb_eGrnInvalidArgument,
238
+ "snippet text must be String: <%s>",
239
+ rb_grn_inspect(rb_string));
240
240
  }
241
241
 
242
242
  #ifdef HAVE_RUBY_ENCODING_H
@@ -257,7 +257,7 @@ rb_grn_snippet_execute (VALUE self, VALUE rb_string)
257
257
  unsigned result_length;
258
258
 
259
259
  rc = grn_snip_get_result(context, (grn_snip *)snippet,
260
- i, result, &result_length);
260
+ i, result, &result_length);
261
261
  rb_grn_rc_check(rc, self);
262
262
  rb_result = rb_grn_context_rb_string_new(context, result, result_length);
263
263
  rb_ary_push(rb_results, rb_result);
@@ -44,13 +44,13 @@ rb_grn_table_cursor_get_key (VALUE self)
44
44
  grn_table_cursor *cursor;
45
45
 
46
46
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
47
- NULL, NULL, NULL, NULL);
47
+ NULL, NULL, NULL, NULL);
48
48
  if (context && cursor) {
49
49
  void *key;
50
50
  int key_size;
51
- grn_obj *table;
51
+ grn_obj *table;
52
52
 
53
- table = grn_table_cursor_table(context, cursor);
53
+ table = grn_table_cursor_table(context, cursor);
54
54
  key_size = grn_table_cursor_get_key(context, cursor, &key);
55
55
  rb_key = GRNKEY2RVAL(context, key, key_size, table, self);
56
56
  }
@@ -62,7 +62,7 @@ void
62
62
  rb_grn_init_table_cursor_key_support (VALUE mGrn)
63
63
  {
64
64
  rb_mGrnTableCursorKeySupport =
65
- rb_define_module_under(rb_cGrnTableCursor, "KeySupport");
65
+ rb_define_module_under(rb_cGrnTableCursor, "KeySupport");
66
66
 
67
67
  rb_define_method(rb_mGrnTableCursorKeySupport, "key",
68
68
  rb_grn_table_cursor_get_key, 0);
@@ -35,38 +35,38 @@ rb_grn_table_cursor_from_ruby_object (VALUE object, grn_ctx **context)
35
35
  grn_table_cursor *table_cursor;
36
36
 
37
37
  if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnTableCursor))) {
38
- rb_raise(rb_eTypeError, "not a groonga table cursor");
38
+ rb_raise(rb_eTypeError, "not a groonga table cursor");
39
39
  }
40
40
 
41
41
  rb_grn_table_cursor_deconstruct(SELF(object), &table_cursor, NULL,
42
- NULL, NULL,
43
- NULL, NULL);
42
+ NULL, NULL,
43
+ NULL, NULL);
44
44
  return table_cursor;
45
45
  }
46
46
 
47
47
  VALUE
48
48
  rb_grn_table_cursor_to_ruby_object (VALUE klass, grn_ctx *context,
49
- grn_table_cursor *cursor,
50
- grn_bool owner)
49
+ grn_table_cursor *cursor,
50
+ grn_bool owner)
51
51
  {
52
52
  return GRNOBJECT2RVAL(klass, context, cursor, owner);
53
53
  }
54
54
 
55
55
  void
56
56
  rb_grn_table_cursor_deconstruct (RbGrnTableCursor *rb_grn_table_cursor,
57
- grn_table_cursor **cursor,
58
- grn_ctx **context,
59
- grn_id *domain_id,
60
- grn_obj **domain,
61
- grn_id *range_id,
62
- grn_obj **range)
57
+ grn_table_cursor **cursor,
58
+ grn_ctx **context,
59
+ grn_id *domain_id,
60
+ grn_obj **domain,
61
+ grn_id *range_id,
62
+ grn_obj **range)
63
63
  {
64
64
  RbGrnObject *rb_grn_object;
65
65
 
66
66
  rb_grn_object = RB_GRN_OBJECT(rb_grn_table_cursor);
67
67
  rb_grn_object_deconstruct(rb_grn_object, cursor, context,
68
- domain_id, domain,
69
- range_id, range);
68
+ domain_id, domain,
69
+ range_id, range);
70
70
  }
71
71
 
72
72
  int
@@ -75,17 +75,17 @@ rb_grn_table_cursor_order_to_flag (VALUE rb_order)
75
75
  int flag = 0;
76
76
 
77
77
  if (NIL_P(rb_order) ||
78
- rb_grn_equal_option(rb_order, "asc") ||
79
- rb_grn_equal_option(rb_order, "ascending")) {
80
- flag |= GRN_CURSOR_ASCENDING;
78
+ rb_grn_equal_option(rb_order, "asc") ||
79
+ rb_grn_equal_option(rb_order, "ascending")) {
80
+ flag |= GRN_CURSOR_ASCENDING;
81
81
  } else if (rb_grn_equal_option(rb_order, "desc") ||
82
- rb_grn_equal_option(rb_order, "descending")) {
83
- flag |= GRN_CURSOR_DESCENDING;
82
+ rb_grn_equal_option(rb_order, "descending")) {
83
+ flag |= GRN_CURSOR_DESCENDING;
84
84
  } else {
85
- rb_raise(rb_eArgError,
86
- "order should be one of "
87
- "[:asc, :ascending, :desc, :descending]: %s",
88
- rb_grn_inspect(rb_order));
85
+ rb_raise(rb_eArgError,
86
+ "order should be one of "
87
+ "[:asc, :ascending, :desc, :descending]: %s",
88
+ rb_grn_inspect(rb_order));
89
89
  }
90
90
 
91
91
  return flag;
@@ -93,32 +93,32 @@ rb_grn_table_cursor_order_to_flag (VALUE rb_order)
93
93
 
94
94
  int
95
95
  rb_grn_table_cursor_order_by_to_flag (unsigned char table_type,
96
- VALUE rb_table,
97
- VALUE rb_order_by)
96
+ VALUE rb_table,
97
+ VALUE rb_order_by)
98
98
  {
99
99
  int flag = 0;
100
100
 
101
101
  if (NIL_P(rb_order_by)) {
102
- if (table_type == GRN_TABLE_PAT_KEY) {
103
- flag |= GRN_CURSOR_BY_KEY;
104
- } else {
105
- flag |= GRN_CURSOR_BY_ID;
106
- }
102
+ if (table_type == GRN_TABLE_PAT_KEY) {
103
+ flag |= GRN_CURSOR_BY_KEY;
104
+ } else {
105
+ flag |= GRN_CURSOR_BY_ID;
106
+ }
107
107
  } else if (rb_grn_equal_option(rb_order_by, "id")) {
108
- flag |= GRN_CURSOR_BY_ID;
108
+ flag |= GRN_CURSOR_BY_ID;
109
109
  } else if (rb_grn_equal_option(rb_order_by, "key")) {
110
- if (table_type != GRN_TABLE_PAT_KEY) {
111
- rb_raise(rb_eArgError,
112
- "order_by => :key is available "
113
- "only for Groonga::PatriciaTrie: %s",
114
- rb_grn_inspect(rb_table));
115
- }
116
- flag |= GRN_CURSOR_BY_KEY;
110
+ if (table_type != GRN_TABLE_PAT_KEY) {
111
+ rb_raise(rb_eArgError,
112
+ "order_by => :key is available "
113
+ "only for Groonga::PatriciaTrie: %s",
114
+ rb_grn_inspect(rb_table));
115
+ }
116
+ flag |= GRN_CURSOR_BY_KEY;
117
117
  } else {
118
- rb_raise(rb_eArgError,
119
- "order_by should be one of [:id%s]: %s",
120
- table_type == GRN_TABLE_PAT_KEY ? ", :key" : "",
121
- rb_grn_inspect(rb_order_by));
118
+ rb_raise(rb_eArgError,
119
+ "order_by should be one of [:id%s]: %s",
120
+ table_type == GRN_TABLE_PAT_KEY ? ", :key" : "",
121
+ rb_grn_inspect(rb_order_by));
122
122
  }
123
123
 
124
124
  return flag;
@@ -138,7 +138,7 @@ rb_grn_table_cursor_get_value (VALUE self)
138
138
  VALUE rb_value = Qnil;
139
139
 
140
140
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
141
- NULL, NULL, NULL, NULL);
141
+ NULL, NULL, NULL, NULL);
142
142
  if (context && cursor) {
143
143
  int n;
144
144
  void *value;
@@ -163,14 +163,14 @@ rb_grn_table_cursor_set_value (VALUE self, VALUE value)
163
163
  grn_table_cursor *cursor;
164
164
 
165
165
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
166
- NULL, NULL, NULL, NULL);
166
+ NULL, NULL, NULL, NULL);
167
167
  if (context && cursor) {
168
168
  grn_rc rc;
169
169
 
170
170
  rc = grn_table_cursor_set_value(context,
171
171
  cursor,
172
172
  StringValuePtr(value),
173
- GRN_OBJ_SET);
173
+ GRN_OBJ_SET);
174
174
  rb_grn_rc_check(rc, self);
175
175
  }
176
176
 
@@ -189,7 +189,7 @@ rb_grn_table_cursor_delete (VALUE self)
189
189
  grn_table_cursor *cursor;
190
190
 
191
191
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
192
- NULL, NULL, NULL, NULL);
192
+ NULL, NULL, NULL, NULL);
193
193
  if (context && cursor) {
194
194
  grn_rc rc;
195
195
 
@@ -214,14 +214,14 @@ rb_grn_table_cursor_next (VALUE self)
214
214
  grn_table_cursor *cursor;
215
215
 
216
216
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
217
- NULL, NULL, NULL, NULL);
217
+ NULL, NULL, NULL, NULL);
218
218
  if (context && cursor) {
219
219
  grn_id record_id;
220
220
 
221
221
  record_id = grn_table_cursor_next(context, cursor);
222
222
  if (record_id != GRN_ID_NIL) /* FIXME: use grn_table_cursor_table */
223
223
  rb_record = rb_grn_record_new(rb_iv_get(self, "@table"),
224
- record_id, Qnil);
224
+ record_id, Qnil);
225
225
  }
226
226
 
227
227
  return rb_record;
@@ -243,13 +243,13 @@ rb_grn_table_cursor_each (VALUE self)
243
243
  RETURN_ENUMERATOR(self, 0, NULL);
244
244
 
245
245
  rb_grn_table_cursor_deconstruct(SELF(self), &cursor, &context,
246
- NULL, NULL, NULL, NULL);
246
+ NULL, NULL, NULL, NULL);
247
247
 
248
248
  if (context && cursor) {
249
- while ((record_id = grn_table_cursor_next(context, cursor))) {
250
- rb_yield(rb_grn_record_new(rb_iv_get(self, "@table"),
251
- record_id, Qnil));
252
- }
249
+ while ((record_id = grn_table_cursor_next(context, cursor))) {
250
+ rb_yield(rb_grn_record_new(rb_iv_get(self, "@table"),
251
+ record_id, Qnil));
252
+ }
253
253
  }
254
254
 
255
255
  return Qnil;