rroonga 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/Gemfile +20 -0
- data/Rakefile +187 -0
- data/doc/text/news.textile +10 -2
- data/doc/text/tutorial.textile +0 -2
- data/ext/groonga/extconf.rb +7 -1
- data/ext/groonga/rb-grn-accessor.c +11 -11
- data/ext/groonga/rb-grn-array.c +25 -25
- data/ext/groonga/rb-grn-column.c +106 -106
- data/ext/groonga/rb-grn-context.c +121 -121
- data/ext/groonga/rb-grn-database.c +78 -78
- data/ext/groonga/rb-grn-double-array-trie.c +92 -92
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +28 -28
- data/ext/groonga/rb-grn-exception.c +9 -9
- data/ext/groonga/rb-grn-expression-builder.c +6 -6
- data/ext/groonga/rb-grn-expression.c +87 -87
- data/ext/groonga/rb-grn-fix-size-column.c +12 -12
- data/ext/groonga/rb-grn-geo-point.c +2 -2
- data/ext/groonga/rb-grn-hash.c +38 -38
- data/ext/groonga/rb-grn-index-column.c +191 -191
- data/ext/groonga/rb-grn-index-cursor.c +29 -29
- data/ext/groonga/rb-grn-logger.c +36 -36
- data/ext/groonga/rb-grn-normalizer.c +10 -10
- data/ext/groonga/rb-grn-patricia-trie.c +196 -196
- data/ext/groonga/rb-grn-plugin.c +5 -5
- data/ext/groonga/rb-grn-posting.c +2 -2
- data/ext/groonga/rb-grn-procedure.c +2 -2
- data/ext/groonga/rb-grn-query-logger.c +1 -1
- data/ext/groonga/rb-grn-record.c +1 -1
- data/ext/groonga/rb-grn-snippet.c +14 -14
- data/ext/groonga/rb-grn-table-cursor-key-support.c +4 -4
- data/ext/groonga/rb-grn-table-cursor.c +52 -52
- data/ext/groonga/rb-grn-table-key-support.c +209 -209
- data/ext/groonga/rb-grn-type.c +18 -18
- data/ext/groonga/rb-grn-utils.c +332 -314
- data/ext/groonga/rb-grn-variable-size-column.c +34 -34
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn.h +240 -232
- data/ext/groonga/rb-groonga.c +10 -10
- data/rroonga-build.rb +7 -0
- data/rroonga.gemspec +1 -1
- data/test/test-hash.rb +4 -4
- data/test/test-index-column.rb +271 -257
- data/test/test-table-key-support.rb +78 -0
- data/test/test-table.rb +78 -51
- metadata +195 -164
- checksums.yaml +0 -7
@@ -25,10 +25,10 @@ VALUE rb_cGrnIndexCursor;
|
|
25
25
|
|
26
26
|
VALUE
|
27
27
|
rb_grn_index_cursor_to_ruby_object (grn_ctx *context,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
grn_obj *cursor,
|
29
|
+
VALUE rb_table,
|
30
|
+
VALUE rb_lexicon,
|
31
|
+
grn_bool owner)
|
32
32
|
{
|
33
33
|
VALUE rb_cursor;
|
34
34
|
|
@@ -41,19 +41,19 @@ rb_grn_index_cursor_to_ruby_object (grn_ctx *context,
|
|
41
41
|
|
42
42
|
void
|
43
43
|
rb_grn_index_cursor_deconstruct (RbGrnIndexCursor *rb_grn_index_cursor,
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
grn_obj **cursor,
|
45
|
+
grn_ctx **context,
|
46
|
+
grn_id *domain_id,
|
47
|
+
grn_obj **domain,
|
48
|
+
grn_id *range_id,
|
49
|
+
grn_obj **range)
|
50
50
|
{
|
51
51
|
RbGrnObject *rb_grn_object;
|
52
52
|
|
53
53
|
rb_grn_object = RB_GRN_OBJECT(rb_grn_index_cursor);
|
54
54
|
rb_grn_object_deconstruct(rb_grn_object, cursor, context,
|
55
|
-
|
56
|
-
|
55
|
+
domain_id, domain,
|
56
|
+
range_id, range);
|
57
57
|
}
|
58
58
|
|
59
59
|
static VALUE
|
@@ -64,7 +64,7 @@ next_value (grn_ctx *context, grn_obj *cursor, VALUE rb_table, VALUE rb_lexicon)
|
|
64
64
|
|
65
65
|
posting = grn_index_cursor_next(context, cursor, &term_id);
|
66
66
|
if (!posting) {
|
67
|
-
|
67
|
+
return Qnil;
|
68
68
|
}
|
69
69
|
|
70
70
|
return rb_grn_posting_new(posting, term_id, rb_table, rb_lexicon);
|
@@ -78,13 +78,13 @@ rb_grn_index_cursor_next (VALUE self)
|
|
78
78
|
grn_ctx *context;
|
79
79
|
|
80
80
|
rb_grn_index_cursor_deconstruct(SELF(self), &cursor, &context,
|
81
|
-
|
81
|
+
NULL, NULL, NULL, NULL);
|
82
82
|
if (context && cursor) {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
VALUE rb_table;
|
84
|
+
VALUE rb_lexicon;
|
85
|
+
rb_table = rb_iv_get(self, "@table");
|
86
|
+
rb_lexicon = rb_iv_get(self, "@lexicon");
|
87
|
+
rb_posting = next_value(context, cursor, rb_table, rb_lexicon);
|
88
88
|
}
|
89
89
|
|
90
90
|
return rb_posting;
|
@@ -102,25 +102,25 @@ rb_grn_index_cursor_each (VALUE self)
|
|
102
102
|
RETURN_ENUMERATOR(self, 0, NULL);
|
103
103
|
|
104
104
|
rb_grn_index_cursor_deconstruct(SELF(self), &cursor, &context,
|
105
|
-
|
105
|
+
NULL, NULL, NULL, NULL);
|
106
106
|
|
107
107
|
if (!context) {
|
108
|
-
|
108
|
+
return Qnil;
|
109
109
|
}
|
110
110
|
|
111
111
|
if (!cursor) {
|
112
|
-
|
112
|
+
return Qnil;
|
113
113
|
}
|
114
114
|
|
115
115
|
rb_table = rb_iv_get(self, "@table");
|
116
116
|
rb_lexicon = rb_iv_get(self, "@lexicon");
|
117
117
|
while (GRN_TRUE) {
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
VALUE rb_posting;
|
119
|
+
rb_posting = next_value(context, cursor, rb_table, rb_lexicon);
|
120
|
+
if (NIL_P(rb_posting)) {
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
rb_yield(rb_posting);
|
124
124
|
}
|
125
125
|
|
126
126
|
return Qnil;
|
@@ -130,7 +130,7 @@ void
|
|
130
130
|
rb_grn_init_index_cursor (VALUE mGrn)
|
131
131
|
{
|
132
132
|
rb_cGrnIndexCursor =
|
133
|
-
|
133
|
+
rb_define_class_under(mGrn, "IndexCursor", rb_cGrnObject);
|
134
134
|
rb_define_alloc_func(rb_cGrnIndexCursor, rb_grn_object_alloc);
|
135
135
|
rb_include_module(rb_cGrnIndexCursor, rb_mEnumerable);
|
136
136
|
|
data/ext/groonga/rb-grn-logger.c
CHANGED
@@ -85,38 +85,38 @@ rb_grn_log_level_to_ruby_object (grn_log_level level)
|
|
85
85
|
|
86
86
|
switch (level) {
|
87
87
|
case GRN_LOG_NONE:
|
88
|
-
|
89
|
-
|
88
|
+
rb_level = RB_GRN_INTERN("none");
|
89
|
+
break;
|
90
90
|
case GRN_LOG_EMERG:
|
91
|
-
|
92
|
-
|
91
|
+
rb_level = RB_GRN_INTERN("emergency");
|
92
|
+
break;
|
93
93
|
case GRN_LOG_ALERT:
|
94
|
-
|
95
|
-
|
94
|
+
rb_level = RB_GRN_INTERN("alert");
|
95
|
+
break;
|
96
96
|
case GRN_LOG_CRIT:
|
97
|
-
|
98
|
-
|
97
|
+
rb_level = RB_GRN_INTERN("critical");
|
98
|
+
break;
|
99
99
|
case GRN_LOG_ERROR:
|
100
|
-
|
101
|
-
|
100
|
+
rb_level = RB_GRN_INTERN("error");
|
101
|
+
break;
|
102
102
|
case GRN_LOG_WARNING:
|
103
|
-
|
104
|
-
|
103
|
+
rb_level = RB_GRN_INTERN("warning");
|
104
|
+
break;
|
105
105
|
case GRN_LOG_NOTICE:
|
106
|
-
|
107
|
-
|
106
|
+
rb_level = RB_GRN_INTERN("notice");
|
107
|
+
break;
|
108
108
|
case GRN_LOG_INFO:
|
109
|
-
|
110
|
-
|
109
|
+
rb_level = RB_GRN_INTERN("info");
|
110
|
+
break;
|
111
111
|
case GRN_LOG_DEBUG:
|
112
|
-
|
113
|
-
|
112
|
+
rb_level = RB_GRN_INTERN("debug");
|
113
|
+
break;
|
114
114
|
case GRN_LOG_DUMP:
|
115
|
-
|
116
|
-
|
115
|
+
rb_level = RB_GRN_INTERN("dump");
|
116
|
+
break;
|
117
117
|
default:
|
118
|
-
|
119
|
-
|
118
|
+
rb_level = INT2NUM(level);
|
119
|
+
break;
|
120
120
|
}
|
121
121
|
|
122
122
|
return rb_level;
|
@@ -133,10 +133,10 @@ rb_grn_logger_reset_with_error_check (VALUE klass, grn_ctx *context)
|
|
133
133
|
rb_cv_set(klass, "@@current_logger", Qnil);
|
134
134
|
|
135
135
|
if (context) {
|
136
|
-
|
137
|
-
|
136
|
+
grn_logger_set(context, NULL);
|
137
|
+
rb_grn_context_check(context, current_logger);
|
138
138
|
} else {
|
139
|
-
|
139
|
+
grn_logger_set(NULL, NULL);
|
140
140
|
}
|
141
141
|
}
|
142
142
|
|
@@ -148,8 +148,8 @@ rb_grn_logger_reset (VALUE klass)
|
|
148
148
|
|
149
149
|
static void
|
150
150
|
rb_grn_logger_log (grn_ctx *ctx, grn_log_level level,
|
151
|
-
|
152
|
-
|
151
|
+
const char *timestamp, const char *title, const char *message,
|
152
|
+
const char *location, void *user_data)
|
153
153
|
{
|
154
154
|
VALUE handler = (VALUE)user_data;
|
155
155
|
|
@@ -162,7 +162,7 @@ rb_grn_logger_log (grn_ctx *ctx, grn_log_level level,
|
|
162
162
|
rb_str_new2(timestamp),
|
163
163
|
rb_str_new2(title),
|
164
164
|
rb_str_new2(message),
|
165
|
-
|
165
|
+
rb_str_new2(location));
|
166
166
|
}
|
167
167
|
|
168
168
|
static void
|
@@ -246,20 +246,20 @@ rb_grn_logger_s_register (int argc, VALUE *argv, VALUE klass)
|
|
246
246
|
"flags", &rb_flags,
|
247
247
|
NULL);
|
248
248
|
if (!NIL_P(rb_max_level)) {
|
249
|
-
|
249
|
+
max_level = RVAL2GRNLOGLEVEL(rb_max_level);
|
250
250
|
}
|
251
251
|
|
252
252
|
if (NIL_P(rb_time) || CBOOL2RVAL(rb_time)) {
|
253
|
-
|
253
|
+
flags |= GRN_LOG_TIME;
|
254
254
|
}
|
255
255
|
if (NIL_P(rb_title) || CBOOL2RVAL(rb_title)) {
|
256
|
-
|
256
|
+
flags |= GRN_LOG_TITLE;
|
257
257
|
}
|
258
258
|
if (NIL_P(rb_message) || CBOOL2RVAL(rb_message)) {
|
259
|
-
|
259
|
+
flags |= GRN_LOG_MESSAGE;
|
260
260
|
}
|
261
261
|
if (NIL_P(rb_location) || CBOOL2RVAL(rb_location)) {
|
262
|
-
|
262
|
+
flags |= GRN_LOG_LOCATION;
|
263
263
|
}
|
264
264
|
if (!NIL_P(rb_flags)) {
|
265
265
|
flags = rb_funcall(mGrnLoggerFlags, id_parse, 2,
|
@@ -355,7 +355,7 @@ rb_grn_logger_s_get_path (VALUE klass)
|
|
355
355
|
|
356
356
|
path = grn_default_logger_get_path();
|
357
357
|
if (path) {
|
358
|
-
|
358
|
+
rb_path = rb_str_new2(path);
|
359
359
|
}
|
360
360
|
return rb_path;
|
361
361
|
}
|
@@ -401,7 +401,7 @@ rb_grn_logger_s_set_path (VALUE klass, VALUE rb_path)
|
|
401
401
|
grn_default_logger_set_path(path);
|
402
402
|
|
403
403
|
if (need_reopen) {
|
404
|
-
|
404
|
+
rb_grn_logger_s_reopen_with_related_object(klass, rb_path);
|
405
405
|
}
|
406
406
|
|
407
407
|
return Qnil;
|
@@ -439,7 +439,7 @@ rb_grn_init_logger (VALUE mGrn)
|
|
439
439
|
|
440
440
|
mGrnLoggerFlags = rb_define_module_under(cGrnLogger, "Flags");
|
441
441
|
#define DEFINE_FLAG(NAME) \
|
442
|
-
rb_define_const(mGrnLoggerFlags,
|
442
|
+
rb_define_const(mGrnLoggerFlags, \
|
443
443
|
#NAME, INT2NUM(GRN_LOG_ ## NAME))
|
444
444
|
DEFINE_FLAG(TIME);
|
445
445
|
DEFINE_FLAG(TITLE);
|
@@ -56,18 +56,18 @@ rb_grn_normalizer_s_normalize (VALUE klass, VALUE rb_string)
|
|
56
56
|
context = rb_grn_context_ensure(&rb_context);
|
57
57
|
rb_encoded_string = rb_grn_context_rb_string_encode(context, rb_string);
|
58
58
|
grn_string = grn_string_open(context,
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
RSTRING_PTR(rb_encoded_string),
|
60
|
+
RSTRING_LEN(rb_encoded_string),
|
61
|
+
normalizer,
|
62
|
+
flags);
|
63
63
|
rb_grn_context_check(context, rb_string);
|
64
64
|
grn_string_get_normalized(context, grn_string,
|
65
|
-
|
66
|
-
|
65
|
+
&normalized_string, &normalized_string_length,
|
66
|
+
NULL);
|
67
67
|
rb_normalized_string =
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
rb_grn_context_rb_string_new(context,
|
69
|
+
normalized_string,
|
70
|
+
normalized_string_length);
|
71
71
|
grn_obj_close(context, grn_string);
|
72
72
|
|
73
73
|
return rb_normalized_string;
|
@@ -79,5 +79,5 @@ rb_grn_init_normalizer (VALUE mGrn)
|
|
79
79
|
rb_cGrnNormalizer = rb_define_class_under(mGrn, "Normalizer", rb_cObject);
|
80
80
|
|
81
81
|
rb_define_singleton_method(rb_cGrnNormalizer, "normalize",
|
82
|
-
|
82
|
+
rb_grn_normalizer_s_normalize, 1);
|
83
83
|
}
|