rroonga 4.0.3 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/Gemfile +1 -1
- data/README.textile +1 -1
- data/Rakefile +8 -1
- data/bin/grndump +1 -1
- data/bin/grntest-log-analyze +1 -1
- data/bin/groonga-database-inspect +1 -1
- data/bin/groonga-index-dump +1 -1
- data/doc/text/news.textile +28 -0
- data/ext/groonga/extconf.rb +12 -2
- data/ext/groonga/rb-grn-accessor.c +2 -1
- data/ext/groonga/rb-grn-array-cursor.c +1 -1
- data/ext/groonga/rb-grn-array.c +1 -1
- data/ext/groonga/rb-grn-column.c +1 -1
- data/ext/groonga/rb-grn-context.c +7 -5
- data/ext/groonga/rb-grn-database.c +1 -1
- data/ext/groonga/rb-grn-double-array-trie-cursor.c +1 -1
- data/ext/groonga/rb-grn-double-array-trie.c +1 -1
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +1 -1
- data/ext/groonga/rb-grn-exception.c +1 -1
- data/ext/groonga/rb-grn-expression-builder.c +1 -1
- data/ext/groonga/rb-grn-expression.c +1 -1
- data/ext/groonga/rb-grn-fix-size-column.c +1 -1
- data/ext/groonga/rb-grn-geo-point.c +1 -1
- data/ext/groonga/rb-grn-hash-cursor.c +1 -1
- data/ext/groonga/rb-grn-hash.c +1 -1
- data/ext/groonga/rb-grn-index-column.c +1 -1
- data/ext/groonga/rb-grn-index-cursor.c +1 -1
- data/ext/groonga/rb-grn-logger.c +1 -1
- data/ext/groonga/rb-grn-normalizer.c +1 -1
- data/ext/groonga/rb-grn-object.c +71 -45
- data/ext/groonga/rb-grn-operator.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie-cursor.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +1 -1
- data/ext/groonga/rb-grn-plugin.c +1 -1
- data/ext/groonga/rb-grn-posting.c +1 -1
- data/ext/groonga/rb-grn-procedure-type.c +40 -0
- data/ext/groonga/rb-grn-procedure.c +17 -4
- 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 +1 -1
- data/ext/groonga/rb-grn-table-cursor-key-support.c +1 -1
- data/ext/groonga/rb-grn-table-cursor.c +1 -1
- data/ext/groonga/rb-grn-table-key-support.c +1 -1
- data/ext/groonga/rb-grn-table.c +3 -2
- data/ext/groonga/rb-grn-type.c +1 -1
- data/ext/groonga/rb-grn-utils.c +1 -1
- data/ext/groonga/rb-grn-variable-size-column.c +55 -27
- data/ext/groonga/rb-grn-variable.c +1 -1
- data/ext/groonga/rb-grn.h +4 -2
- data/ext/groonga/rb-groonga.c +3 -2
- data/extconf.rb +1 -1
- data/lib/groonga.rb +1 -1
- data/lib/groonga/column.rb +1 -1
- data/lib/groonga/context.rb +1 -1
- data/lib/groonga/context/command-executor.rb +1 -1
- data/lib/groonga/database-inspector.rb +1 -1
- data/lib/groonga/database.rb +1 -1
- data/lib/groonga/dumper.rb +1 -1
- data/lib/groonga/expression-builder-19.rb +1 -1
- data/lib/groonga/expression-builder.rb +1 -1
- data/lib/groonga/geo-point.rb +1 -1
- data/lib/groonga/grntest-log.rb +1 -1
- data/lib/groonga/index-column.rb +1 -1
- data/lib/groonga/logger.rb +1 -1
- data/lib/groonga/memory-pool.rb +1 -2
- data/lib/groonga/pagination.rb +1 -1
- data/lib/groonga/patricia-trie.rb +1 -1
- data/lib/groonga/posting.rb +1 -1
- data/lib/groonga/query-logger.rb +1 -1
- data/lib/groonga/record.rb +6 -2
- data/lib/groonga/schema.rb +1 -1
- data/lib/groonga/statistic-measurer.rb +1 -1
- data/lib/groonga/sub-records.rb +1 -1
- data/lib/groonga/table.rb +1 -1
- data/misc/grnop2ruby.rb +1 -1
- data/rroonga-build.rb +4 -4
- data/rroonga.gemspec +3 -3
- data/test/groonga-test-utils.rb +4 -4
- data/test/run-test.rb +1 -1
- data/test/test-accessor.rb +1 -1
- data/test/test-array.rb +1 -1
- data/test/test-column.rb +1 -1
- data/test/test-command-select.rb +1 -1
- data/test/test-context.rb +21 -16
- data/test/test-convert.rb +1 -1
- data/test/test-database-dumper.rb +1 -1
- data/test/test-database-inspector.rb +1 -1
- data/test/test-database.rb +38 -25
- data/test/test-double-array-trie.rb +1 -1
- data/test/test-encoding.rb +1 -1
- data/test/test-exception.rb +12 -7
- data/test/test-expression-builder.rb +1 -1
- data/test/test-expression.rb +1 -1
- data/test/test-fix-size-column.rb +1 -1
- data/test/test-geo-point.rb +1 -1
- data/test/test-gqtp.rb +1 -1
- data/test/test-hash.rb +1 -1
- data/test/test-index-column.rb +1 -1
- data/test/test-index-cursor.rb +1 -1
- data/test/test-lock-timeout.rb +1 -1
- data/test/test-logger.rb +1 -1
- data/test/test-memory-pool.rb +1 -1
- data/test/test-normalizer.rb +1 -1
- data/test/test-pagination.rb +1 -1
- data/test/test-patricia-trie.rb +1 -1
- data/test/test-plugin.rb +1 -1
- data/test/test-procedure.rb +9 -2
- data/test/test-record.rb +1 -1
- data/test/test-remote.rb +1 -1
- data/test/test-schema-create-table.rb +1 -1
- data/test/test-schema-dumper.rb +1 -1
- data/test/test-schema-type.rb +1 -1
- data/test/test-schema.rb +1 -1
- data/test/test-snippet.rb +1 -1
- data/test/test-statistic-measurer.rb +1 -1
- data/test/test-sub-records.rb +1 -1
- data/test/test-table-dumper.rb +1 -1
- data/test/test-table-key-support.rb +1 -1
- data/test/test-table-offset-and-limit.rb +1 -1
- data/test/test-table-select-mecab.rb +1 -1
- data/test/test-table-select-normalize.rb +1 -1
- data/test/test-table-select-weight.rb +1 -1
- data/test/test-table-select.rb +1 -1
- data/test/test-table-traverse.rb +1 -1
- data/test/test-table.rb +1 -1
- data/test/test-type.rb +1 -1
- data/test/test-variable-size-column.rb +136 -67
- data/test/test-variable.rb +1 -1
- data/test/test-vector-column.rb +1 -1
- data/test/test-version.rb +1 -1
- metadata +83 -80
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
You should have received a copy of the GNU Lesser General Public
|
16
16
|
License along with this library; if not, write to the Free Software
|
17
|
-
Foundation, Inc.,
|
17
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
*/
|
19
19
|
|
20
20
|
#include "rb-grn.h"
|
data/ext/groonga/rb-grn-plugin.c
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
You should have received a copy of the GNU Lesser General Public
|
16
16
|
License along with this library; if not, write to the Free Software
|
17
|
-
Foundation, Inc.,
|
17
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
*/
|
19
19
|
|
20
20
|
#include "rb-grn.h"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
|
+
/*
|
3
|
+
Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
|
5
|
+
This library is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU Lesser General Public
|
7
|
+
License version 2.1 as published by the Free Software Foundation.
|
8
|
+
|
9
|
+
This library is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public
|
15
|
+
License along with this library; if not, write to the Free Software
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include "rb-grn.h"
|
20
|
+
|
21
|
+
void
|
22
|
+
rb_grn_init_procedure_type (VALUE mGrn)
|
23
|
+
{
|
24
|
+
VALUE rb_mGrnProcedureType;
|
25
|
+
|
26
|
+
rb_mGrnProcedureType = rb_define_module_under(mGrn, "ProcedureType");
|
27
|
+
|
28
|
+
rb_define_const(rb_mGrnProcedureType,
|
29
|
+
"INVALID", INT2NUM(GRN_PROC_INVALID));
|
30
|
+
rb_define_const(rb_mGrnProcedureType,
|
31
|
+
"TOKENIZER", INT2NUM(GRN_PROC_TOKENIZER));
|
32
|
+
rb_define_const(rb_mGrnProcedureType,
|
33
|
+
"COMMAND", INT2NUM(GRN_PROC_COMMAND));
|
34
|
+
rb_define_const(rb_mGrnProcedureType,
|
35
|
+
"FUNCTION", INT2NUM(GRN_PROC_FUNCTION));
|
36
|
+
rb_define_const(rb_mGrnProcedureType,
|
37
|
+
"HOOK", INT2NUM(GRN_PROC_HOOK));
|
38
|
+
rb_define_const(rb_mGrnProcedureType,
|
39
|
+
"NORMALIZER", INT2NUM(GRN_PROC_NORMALIZER));
|
40
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -13,13 +13,11 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
20
20
|
|
21
|
-
#define SELF(object) (RVAL2GRNPROCEDURE(object))
|
22
|
-
|
23
21
|
VALUE rb_cGrnProcedure;
|
24
22
|
|
25
23
|
grn_obj *
|
@@ -39,6 +37,19 @@ rb_grn_procedure_to_ruby_object (grn_ctx *context, grn_obj *procedure,
|
|
39
37
|
return GRNOBJECT2RVAL(rb_cGrnProcedure, context, procedure, owner);
|
40
38
|
}
|
41
39
|
|
40
|
+
static VALUE
|
41
|
+
rb_grn_procedure_get_type (VALUE self)
|
42
|
+
{
|
43
|
+
grn_ctx *context;
|
44
|
+
grn_obj *procedure;
|
45
|
+
grn_proc_type type;
|
46
|
+
|
47
|
+
procedure = RVAL2GRNOBJECT(self, &context);
|
48
|
+
type = grn_proc_get_type(context, procedure);
|
49
|
+
|
50
|
+
return INT2NUM(type);
|
51
|
+
}
|
52
|
+
|
42
53
|
void
|
43
54
|
rb_grn_init_procedure (VALUE mGrn)
|
44
55
|
{
|
@@ -49,4 +60,6 @@ rb_grn_init_procedure (VALUE mGrn)
|
|
49
60
|
rb_define_const(rb_cGrnProcedure, "BIGRAM", INT2NUM(GRN_DB_BIGRAM));
|
50
61
|
rb_define_const(rb_cGrnProcedure, "TRIGRAM", INT2NUM(GRN_DB_TRIGRAM));
|
51
62
|
rb_define_const(rb_cGrnProcedure, "MECAB", INT2NUM(GRN_DB_MECAB));
|
63
|
+
|
64
|
+
rb_define_method(rb_cGrnProcedure, "type", rb_grn_procedure_get_type, 0);
|
52
65
|
}
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
data/ext/groonga/rb-grn-record.c
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
data/ext/groonga/rb-grn-table.c
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -77,6 +77,7 @@ rb_grn_table_bind (RbGrnTable *rb_grn_table,
|
|
77
77
|
rb_grn_object = RB_GRN_OBJECT(rb_grn_table);
|
78
78
|
rb_grn_table->value = grn_obj_open(context, GRN_BULK, 0,
|
79
79
|
rb_grn_object->range_id);
|
80
|
+
rb_grn_table->columns = Qnil; /* For GC while the below rb_ary_new(). */
|
80
81
|
rb_grn_table->columns = rb_ary_new();
|
81
82
|
}
|
82
83
|
|
@@ -543,7 +544,7 @@ rb_grn_table_get_column (VALUE self, VALUE rb_name)
|
|
543
544
|
owner = column->header.type == GRN_ACCESSOR;
|
544
545
|
rb_column = GRNCOLUMN2RVAL(Qnil, context, column, owner);
|
545
546
|
if (owner) {
|
546
|
-
|
547
|
+
rb_grn_context_register_floating_object(DATA_PTR(rb_column));
|
547
548
|
}
|
548
549
|
rb_grn_named_object_set_name(RB_GRN_NAMED_OBJECT(DATA_PTR(rb_column)),
|
549
550
|
name, name_size);
|
data/ext/groonga/rb-grn-type.c
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
data/ext/groonga/rb-grn-utils.c
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
You should have received a copy of the GNU Lesser General Public
|
16
16
|
License along with this library; if not, write to the Free Software
|
17
|
-
Foundation, Inc.,
|
17
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
*/
|
19
19
|
|
20
20
|
#include "rb-grn.h"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -163,6 +163,7 @@ rb_grn_variable_size_column_array_reference (VALUE self, VALUE rb_id)
|
|
163
163
|
grn_id id;
|
164
164
|
grn_obj *value;
|
165
165
|
VALUE rb_value;
|
166
|
+
VALUE rb_range;
|
166
167
|
unsigned int i, n;
|
167
168
|
|
168
169
|
rb_grn_variable_size_column_deconstruct(SELF(self), &column, &context,
|
@@ -181,25 +182,36 @@ rb_grn_variable_size_column_array_reference (VALUE self, VALUE rb_id)
|
|
181
182
|
grn_obj_get_value(context, column, id, value);
|
182
183
|
rb_grn_context_check(context, self);
|
183
184
|
|
185
|
+
rb_range = GRNTABLE2RVAL(context, range, GRN_FALSE);
|
186
|
+
|
184
187
|
n = grn_vector_size(context, value);
|
185
188
|
rb_value = rb_ary_new2(n);
|
186
189
|
for (i = 0; i < n; i++) {
|
187
|
-
|
188
|
-
unsigned int element_value_length;
|
190
|
+
VALUE rb_element_value;
|
189
191
|
unsigned int weight = 0;
|
190
192
|
grn_id domain;
|
191
193
|
VALUE rb_element;
|
192
194
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
if (value->header.type == GRN_UVECTOR) {
|
196
|
+
grn_id id;
|
197
|
+
id = grn_uvector_get_element(context, value, i, &weight);
|
198
|
+
rb_element_value = rb_grn_record_new(rb_range, id, Qnil);
|
199
|
+
} else {
|
200
|
+
const char *element_value;
|
201
|
+
unsigned int element_value_length;
|
202
|
+
element_value_length = grn_vector_get_element(context,
|
203
|
+
value,
|
204
|
+
i,
|
205
|
+
&element_value,
|
206
|
+
&weight,
|
207
|
+
&domain);
|
208
|
+
rb_element_value = rb_str_new(element_value, element_value_length);
|
209
|
+
}
|
210
|
+
|
199
211
|
rb_element = rb_hash_new();
|
200
212
|
rb_hash_aset(rb_element,
|
201
213
|
ID2SYM(rb_intern("value")),
|
202
|
-
|
214
|
+
rb_element_value);
|
203
215
|
rb_hash_aset(rb_element,
|
204
216
|
ID2SYM(rb_intern("weight")),
|
205
217
|
UINT2NUM(weight));
|
@@ -211,9 +223,11 @@ rb_grn_variable_size_column_array_reference (VALUE self, VALUE rb_id)
|
|
211
223
|
}
|
212
224
|
|
213
225
|
typedef struct {
|
226
|
+
VALUE self;
|
214
227
|
grn_ctx *context;
|
215
228
|
grn_obj *vector;
|
216
229
|
grn_obj *element_value;
|
230
|
+
grn_obj *range;
|
217
231
|
} HashElementToVectorElementData;
|
218
232
|
|
219
233
|
static int
|
@@ -223,15 +237,21 @@ hash_element_to_vector_element(VALUE key, VALUE value, VALUE user_data)
|
|
223
237
|
(HashElementToVectorElementData *)user_data;
|
224
238
|
unsigned int weight;
|
225
239
|
|
226
|
-
GRN_BULK_REWIND(data->element_value);
|
227
|
-
RVAL2GRNBULK(key, data->context, data->element_value);
|
228
|
-
|
229
240
|
weight = NUM2UINT(value);
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
241
|
+
|
242
|
+
if (data->vector->header.type == GRN_UVECTOR) {
|
243
|
+
grn_id id = RVAL2GRNID(key, data->context, data->range, data->self);
|
244
|
+
grn_uvector_add_element(data->context, data->vector, id, weight);
|
245
|
+
} else {
|
246
|
+
GRN_BULK_REWIND(data->element_value);
|
247
|
+
RVAL2GRNBULK(key, data->context, data->element_value);
|
248
|
+
|
249
|
+
grn_vector_add_element(data->context, data->vector,
|
250
|
+
GRN_BULK_HEAD(data->element_value),
|
251
|
+
GRN_BULK_VSIZE(data->element_value),
|
252
|
+
weight,
|
253
|
+
data->element_value->header.domain);
|
254
|
+
}
|
235
255
|
|
236
256
|
return ST_CONTINUE;
|
237
257
|
}
|
@@ -373,6 +393,7 @@ rb_grn_variable_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
|
|
373
393
|
grn_obj_reinit(context, value,
|
374
394
|
value->header.domain,
|
375
395
|
value->header.flags | GRN_OBJ_VECTOR);
|
396
|
+
value->header.flags |= GRN_OBJ_WITH_WEIGHT;
|
376
397
|
if (RVAL2CBOOL(rb_obj_is_kind_of(rb_value, rb_cArray))) {
|
377
398
|
int i, n;
|
378
399
|
n = RARRAY_LEN(rb_value);
|
@@ -389,22 +410,29 @@ rb_grn_variable_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
|
|
389
410
|
weight = NUM2UINT(rb_weight);
|
390
411
|
}
|
391
412
|
|
392
|
-
|
393
|
-
|
394
|
-
|
413
|
+
if (value->header.type == GRN_UVECTOR) {
|
414
|
+
grn_id id = RVAL2GRNID(rb_element_value, context, range, self);
|
415
|
+
grn_uvector_add_element(context, value, id, weight);
|
416
|
+
} else {
|
417
|
+
GRN_BULK_REWIND(element_value);
|
418
|
+
if (!NIL_P(rb_element_value)) {
|
419
|
+
RVAL2GRNBULK(rb_element_value, context, element_value);
|
420
|
+
}
|
421
|
+
|
422
|
+
grn_vector_add_element(context, value,
|
423
|
+
GRN_BULK_HEAD(element_value),
|
424
|
+
GRN_BULK_VSIZE(element_value),
|
425
|
+
weight,
|
426
|
+
element_value->header.domain);
|
395
427
|
}
|
396
|
-
|
397
|
-
grn_vector_add_element(context, value,
|
398
|
-
GRN_BULK_HEAD(element_value),
|
399
|
-
GRN_BULK_VSIZE(element_value),
|
400
|
-
weight,
|
401
|
-
element_value->header.domain);
|
402
428
|
}
|
403
429
|
} else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_value, rb_cHash))) {
|
404
430
|
HashElementToVectorElementData data;
|
431
|
+
data.self = self;
|
405
432
|
data.context = context;
|
406
433
|
data.vector = value;
|
407
434
|
data.element_value = element_value;
|
435
|
+
data.range = range;
|
408
436
|
rb_hash_foreach(rb_value, hash_element_to_vector_element, (VALUE)&data);
|
409
437
|
} else {
|
410
438
|
rb_raise(rb_eArgError,
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
data/ext/groonga/rb-grn.h
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#ifndef __RB_GRN_H__
|
@@ -84,7 +84,7 @@ RB_GRN_BEGIN_DECLS
|
|
84
84
|
|
85
85
|
#define RB_GRN_MAJOR_VERSION 4
|
86
86
|
#define RB_GRN_MINOR_VERSION 0
|
87
|
-
#define RB_GRN_MICRO_VERSION
|
87
|
+
#define RB_GRN_MICRO_VERSION 4
|
88
88
|
|
89
89
|
#define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
|
90
90
|
|
@@ -288,6 +288,7 @@ void rb_grn_init_patricia_trie_cursor (VALUE mGrn);
|
|
288
288
|
void rb_grn_init_double_array_trie_cursor (VALUE mGrn);
|
289
289
|
void rb_grn_init_type (VALUE mGrn);
|
290
290
|
void rb_grn_init_procedure (VALUE mGrn);
|
291
|
+
void rb_grn_init_procedure_type (VALUE mGrn);
|
291
292
|
void rb_grn_init_column (VALUE mGrn);
|
292
293
|
void rb_grn_init_fix_size_column (VALUE mGrn);
|
293
294
|
void rb_grn_init_variable_size_column (VALUE mGrn);
|
@@ -374,6 +375,7 @@ VALUE rb_grn_object_set_raw (RbGrnObject *rb_grn_object,
|
|
374
375
|
VALUE rb_value,
|
375
376
|
int flags,
|
376
377
|
VALUE related_object);
|
378
|
+
void rb_grn_object_close_raw (RbGrnObject *rb_grn_object);
|
377
379
|
VALUE rb_grn_object_close (VALUE object);
|
378
380
|
VALUE rb_grn_object_closed_p (VALUE object);
|
379
381
|
VALUE rb_grn_object_inspect_object (VALUE inspected,
|
data/ext/groonga/rb-groonga.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU Lesser General Public
|
15
15
|
License along with this library; if not, write to the Free Software
|
16
|
-
Foundation, Inc.,
|
16
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
@@ -175,6 +175,7 @@ Init_groonga (void)
|
|
175
175
|
rb_grn_init_posting(mGrn);
|
176
176
|
rb_grn_init_type(mGrn);
|
177
177
|
rb_grn_init_procedure(mGrn);
|
178
|
+
rb_grn_init_procedure_type(mGrn);
|
178
179
|
rb_grn_init_column(mGrn);
|
179
180
|
rb_grn_init_accessor(mGrn);
|
180
181
|
rb_grn_init_geo_point(mGrn);
|