rroonga 12.0.0 → 12.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +18 -0
- data/ext/groonga/rb-grn-column.c +24 -2
- data/ext/groonga/rb-grn-data-column.c +193 -1
- data/ext/groonga/rb-grn-expression-builder.c +16 -14
- data/ext/groonga/rb-grn-index-column.c +1 -24
- data/ext/groonga/rb-grn-inverted-index-cursor.c +12 -1
- data/ext/groonga/rb-grn-object.c +25 -1
- data/ext/groonga/rb-grn-patricia-trie.c +61 -5
- data/ext/groonga/rb-grn-request-timer-id.c +9 -1
- data/ext/groonga/rb-grn-table-key-support.c +7 -3
- data/ext/groonga/rb-grn-table.c +96 -26
- data/ext/groonga/rb-grn-variable-size-column.c +35 -28
- data/ext/groonga/rb-grn.h +1 -1
- data/lib/groonga/schema.rb +34 -3
- data/rroonga-build.rb +4 -4
- data/test/test-column.rb +37 -3
- data/test/test-data-column.rb +195 -1
- data/test/test-patricia-trie.rb +22 -3
- data/test/test-remote.rb +2 -1
- metadata +66 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908cb7325ae81681705d729d998fc1a8340110f4917c2cbe3f909e89e49b022e
|
4
|
+
data.tar.gz: d3dd3039d9dfc63b4d13aaa9bbd7db3db7f9024ca5894755b1aeb0e7f1217571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab6d48f53a1f0672f814c423b40df8fe4d5963eee26345bcd308440fe4456ea65b9af4d7ca0614771194931a18388a3a2f6fef0ccafb846759fbc750dfd3f6e
|
7
|
+
data.tar.gz: ba3747fa4338baf72277de7acaf5a35354bb032224d992af00c3c7e6ce0e58c3aeed355cb3d4e811335a3f99d8cbadc114c629f1915e7397fdd638e86e39176b
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 12.0.8: 2022-09-28 {#version-12-0-8}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Add support for creating a {Groonga::PatriciaTrie} without database.
|
8
|
+
|
9
|
+
## 12.0.2: 2022-04-04 {#version-12-0-2}
|
10
|
+
|
11
|
+
### Improvements
|
12
|
+
|
13
|
+
* Added support for `:weight_float32` for vector column. This
|
14
|
+
requires Groonga 12.0.2 or later.
|
15
|
+
|
16
|
+
* Removed needless `Groonga::IndexColumn#with_weight?`.
|
17
|
+
|
18
|
+
* Added support for `:missing_mode` and `:invalid_mode` for scalar
|
19
|
+
column and vector column. This requires Groonga 12.0.2 or later.
|
20
|
+
|
3
21
|
## 12.0.0: 2022-02-09 {#version-12-0-0}
|
4
22
|
|
5
23
|
### Improvements
|
data/ext/groonga/rb-grn-column.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/* vim: set sts=4 sw=4 ts=8 noet: */
|
3
3
|
/*
|
4
|
-
Copyright (C) 2009-
|
4
|
+
Copyright (C) 2009-2022 Sutou Kouhei <kou@clear-code.com>
|
5
5
|
Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
6
6
|
|
7
7
|
This library is free software; you can redistribute it and/or
|
@@ -714,7 +714,7 @@ rb_grn_column_data_p (VALUE self)
|
|
714
714
|
|
715
715
|
/*
|
716
716
|
* @overload with_weight?
|
717
|
-
* @return [Boolean] @true@ if the column is
|
717
|
+
* @return [Boolean] @true@ if the column is created with
|
718
718
|
* @:with_weight => true@ flag, @false@ otherwise.
|
719
719
|
* @since 4.0.1
|
720
720
|
*/
|
@@ -733,6 +733,26 @@ rb_grn_column_with_weight_p(VALUE self)
|
|
733
733
|
return CBOOL2RVAL(flags & GRN_OBJ_WITH_WEIGHT);
|
734
734
|
}
|
735
735
|
|
736
|
+
/*
|
737
|
+
* @overload weight_float32?
|
738
|
+
* @return [Boolean] @true@ if the column uses 32 bit float for weight.
|
739
|
+
* @since 12.0.2
|
740
|
+
*/
|
741
|
+
static VALUE
|
742
|
+
rb_grn_column_weight_float32_p(VALUE self)
|
743
|
+
{
|
744
|
+
grn_obj *column;
|
745
|
+
grn_ctx *context;
|
746
|
+
grn_column_flags flags;
|
747
|
+
|
748
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
749
|
+
NULL, NULL,
|
750
|
+
NULL, NULL, NULL);
|
751
|
+
|
752
|
+
flags = grn_column_get_flags(context, column);
|
753
|
+
return CBOOL2RVAL(flags & GRN_OBJ_WEIGHT_FLOAT32);
|
754
|
+
}
|
755
|
+
|
736
756
|
/*
|
737
757
|
* Return indexes on `column`. If operator is specified, indexes that
|
738
758
|
* can executes the operator are only returned. Otherwise, all indexes
|
@@ -867,6 +887,8 @@ rb_grn_init_column (VALUE mGrn)
|
|
867
887
|
|
868
888
|
rb_define_method(rb_cGrnColumn, "with_weight?",
|
869
889
|
rb_grn_column_with_weight_p, 0);
|
890
|
+
rb_define_method(rb_cGrnColumn, "weight_float32?",
|
891
|
+
rb_grn_column_weight_float32_p, 0);
|
870
892
|
|
871
893
|
rb_define_method(rb_cGrnColumn, "find_indexes",
|
872
894
|
rb_grn_column_find_indexes, -1);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/* vim: set sts=4 sw=4 ts=8 noet: */
|
3
3
|
/*
|
4
|
-
Copyright (C) 2016-
|
4
|
+
Copyright (C) 2016-2022 Sutou Kouhei <kou@clear-code.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
7
7
|
modify it under the terms of the GNU Lesser General Public
|
@@ -245,6 +245,180 @@ rb_grn_data_column_apply_expression (VALUE self)
|
|
245
245
|
return self;
|
246
246
|
}
|
247
247
|
|
248
|
+
/*
|
249
|
+
* @overload missing_mode
|
250
|
+
* @return [:add, :ignore, :nil] The missing mode of the column.
|
251
|
+
* @since 12.0.2
|
252
|
+
*/
|
253
|
+
static VALUE
|
254
|
+
rb_grn_data_column_get_missing_mode(VALUE self)
|
255
|
+
{
|
256
|
+
grn_obj *column;
|
257
|
+
grn_ctx *context;
|
258
|
+
grn_column_flags flags;
|
259
|
+
|
260
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
261
|
+
NULL, NULL,
|
262
|
+
NULL, NULL, NULL);
|
263
|
+
|
264
|
+
flags = grn_column_get_flags(context, column);
|
265
|
+
switch ((flags & GRN_OBJ_MISSING_MASK)) {
|
266
|
+
case GRN_OBJ_MISSING_IGNORE:
|
267
|
+
return rb_id2sym(rb_intern("ignore"));
|
268
|
+
case GRN_OBJ_MISSING_NIL:
|
269
|
+
return rb_id2sym(rb_intern("nil"));
|
270
|
+
default:
|
271
|
+
return rb_id2sym(rb_intern("add"));
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
/*
|
276
|
+
* @overload missing_add?
|
277
|
+
* @return [Boolean] @true@ if the column uses @:add@ missing mode.
|
278
|
+
* @since 12.0.2
|
279
|
+
*/
|
280
|
+
static VALUE
|
281
|
+
rb_grn_data_column_missing_add_p(VALUE self)
|
282
|
+
{
|
283
|
+
grn_obj *column;
|
284
|
+
grn_ctx *context;
|
285
|
+
grn_column_flags flags;
|
286
|
+
|
287
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
288
|
+
NULL, NULL,
|
289
|
+
NULL, NULL, NULL);
|
290
|
+
|
291
|
+
flags = grn_column_get_flags(context, column);
|
292
|
+
return CBOOL2RVAL((flags & GRN_OBJ_MISSING_MASK) == GRN_OBJ_MISSING_ADD);
|
293
|
+
}
|
294
|
+
|
295
|
+
/*
|
296
|
+
* @overload missing_ignore?
|
297
|
+
* @return [Boolean] @true@ if the column uses @:ignore@ missing mode.
|
298
|
+
* @since 12.0.2
|
299
|
+
*/
|
300
|
+
static VALUE
|
301
|
+
rb_grn_data_column_missing_ignore_p(VALUE self)
|
302
|
+
{
|
303
|
+
grn_obj *column;
|
304
|
+
grn_ctx *context;
|
305
|
+
grn_column_flags flags;
|
306
|
+
|
307
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
308
|
+
NULL, NULL,
|
309
|
+
NULL, NULL, NULL);
|
310
|
+
|
311
|
+
flags = grn_column_get_flags(context, column);
|
312
|
+
return CBOOL2RVAL((flags & GRN_OBJ_MISSING_MASK) == GRN_OBJ_MISSING_IGNORE);
|
313
|
+
}
|
314
|
+
|
315
|
+
/*
|
316
|
+
* @overload missing_nil?
|
317
|
+
* @return [Boolean] @true@ if the column uses @:nil@ missing mode.
|
318
|
+
* @since 12.0.2
|
319
|
+
*/
|
320
|
+
static VALUE
|
321
|
+
rb_grn_data_column_missing_nil_p(VALUE self)
|
322
|
+
{
|
323
|
+
grn_obj *column;
|
324
|
+
grn_ctx *context;
|
325
|
+
grn_column_flags flags;
|
326
|
+
|
327
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
328
|
+
NULL, NULL,
|
329
|
+
NULL, NULL, NULL);
|
330
|
+
|
331
|
+
flags = grn_column_get_flags(context, column);
|
332
|
+
return CBOOL2RVAL((flags & GRN_OBJ_MISSING_MASK) == GRN_OBJ_MISSING_NIL);
|
333
|
+
}
|
334
|
+
|
335
|
+
/*
|
336
|
+
* @overload invalid_mode
|
337
|
+
* @return [:error, :warn, :ignore] The invalid mode of the column.
|
338
|
+
* @since 12.0.2
|
339
|
+
*/
|
340
|
+
static VALUE
|
341
|
+
rb_grn_data_column_get_invalid_mode(VALUE self)
|
342
|
+
{
|
343
|
+
grn_obj *column;
|
344
|
+
grn_ctx *context;
|
345
|
+
grn_column_flags flags;
|
346
|
+
|
347
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
348
|
+
NULL, NULL,
|
349
|
+
NULL, NULL, NULL);
|
350
|
+
|
351
|
+
flags = grn_column_get_flags(context, column);
|
352
|
+
switch ((flags & GRN_OBJ_INVALID_MASK)) {
|
353
|
+
case GRN_OBJ_INVALID_WARN:
|
354
|
+
return rb_id2sym(rb_intern("warn"));
|
355
|
+
case GRN_OBJ_INVALID_IGNORE:
|
356
|
+
return rb_id2sym(rb_intern("ignore"));
|
357
|
+
default:
|
358
|
+
return rb_id2sym(rb_intern("error"));
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
/*
|
363
|
+
* @overload invalid_error?
|
364
|
+
* @return [Boolean] @true@ if the column uses @:error@ invalid mode.
|
365
|
+
* @since 12.0.2
|
366
|
+
*/
|
367
|
+
static VALUE
|
368
|
+
rb_grn_data_column_invalid_error_p(VALUE self)
|
369
|
+
{
|
370
|
+
grn_obj *column;
|
371
|
+
grn_ctx *context;
|
372
|
+
grn_column_flags flags;
|
373
|
+
|
374
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
375
|
+
NULL, NULL,
|
376
|
+
NULL, NULL, NULL);
|
377
|
+
|
378
|
+
flags = grn_column_get_flags(context, column);
|
379
|
+
return CBOOL2RVAL((flags & GRN_OBJ_INVALID_MASK) == GRN_OBJ_INVALID_ERROR);
|
380
|
+
}
|
381
|
+
|
382
|
+
/*
|
383
|
+
* @overload invalid_warn?
|
384
|
+
* @return [Boolean] @true@ if the column uses @:warn@ invalid mode.
|
385
|
+
* @since 12.0.2
|
386
|
+
*/
|
387
|
+
static VALUE
|
388
|
+
rb_grn_data_column_invalid_warn_p(VALUE self)
|
389
|
+
{
|
390
|
+
grn_obj *column;
|
391
|
+
grn_ctx *context;
|
392
|
+
grn_column_flags flags;
|
393
|
+
|
394
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
395
|
+
NULL, NULL,
|
396
|
+
NULL, NULL, NULL);
|
397
|
+
|
398
|
+
flags = grn_column_get_flags(context, column);
|
399
|
+
return CBOOL2RVAL((flags & GRN_OBJ_INVALID_MASK) == GRN_OBJ_INVALID_WARN);
|
400
|
+
}
|
401
|
+
|
402
|
+
/*
|
403
|
+
* @overload invalid_ignore?
|
404
|
+
* @return [Boolean] @true@ if the column uses @:ignore@ invalid mode.
|
405
|
+
* @since 12.0.2
|
406
|
+
*/
|
407
|
+
static VALUE
|
408
|
+
rb_grn_data_column_invalid_ignore_p(VALUE self)
|
409
|
+
{
|
410
|
+
grn_obj *column;
|
411
|
+
grn_ctx *context;
|
412
|
+
grn_column_flags flags;
|
413
|
+
|
414
|
+
rb_grn_column_deconstruct(SELF(self), &column, &context,
|
415
|
+
NULL, NULL,
|
416
|
+
NULL, NULL, NULL);
|
417
|
+
|
418
|
+
flags = grn_column_get_flags(context, column);
|
419
|
+
return CBOOL2RVAL((flags & GRN_OBJ_INVALID_MASK) == GRN_OBJ_INVALID_IGNORE);
|
420
|
+
}
|
421
|
+
|
248
422
|
void
|
249
423
|
rb_grn_init_data_column (VALUE mGrn)
|
250
424
|
{
|
@@ -255,6 +429,24 @@ rb_grn_init_data_column (VALUE mGrn)
|
|
255
429
|
rb_define_method(rb_cGrnDataColumn, "apply_expression",
|
256
430
|
rb_grn_data_column_apply_expression, 0);
|
257
431
|
|
432
|
+
rb_define_method(rb_cGrnDataColumn, "missing_mode",
|
433
|
+
rb_grn_data_column_get_missing_mode, 0);
|
434
|
+
rb_define_method(rb_cGrnDataColumn, "missing_add?",
|
435
|
+
rb_grn_data_column_missing_add_p, 0);
|
436
|
+
rb_define_method(rb_cGrnDataColumn, "missing_ignore?",
|
437
|
+
rb_grn_data_column_missing_ignore_p, 0);
|
438
|
+
rb_define_method(rb_cGrnDataColumn, "missing_nil?",
|
439
|
+
rb_grn_data_column_missing_nil_p, 0);
|
440
|
+
|
441
|
+
rb_define_method(rb_cGrnDataColumn, "invalid_mode",
|
442
|
+
rb_grn_data_column_get_invalid_mode, 0);
|
443
|
+
rb_define_method(rb_cGrnDataColumn, "invalid_error?",
|
444
|
+
rb_grn_data_column_invalid_error_p, 0);
|
445
|
+
rb_define_method(rb_cGrnDataColumn, "invalid_warn?",
|
446
|
+
rb_grn_data_column_invalid_warn_p, 0);
|
447
|
+
rb_define_method(rb_cGrnDataColumn, "invalid_ignore?",
|
448
|
+
rb_grn_data_column_invalid_ignore_p, 0);
|
449
|
+
|
258
450
|
rb_grn_init_fix_size_column(mGrn);
|
259
451
|
rb_grn_init_variable_size_column(mGrn);
|
260
452
|
}
|
@@ -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-2022 Sutou Kouhei <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
|
@@ -21,53 +21,55 @@
|
|
21
21
|
VALUE rb_cGrnRecordExpressionBuilder;
|
22
22
|
VALUE rb_cGrnColumnExpressionBuilder;
|
23
23
|
|
24
|
+
static ID id_build;
|
25
|
+
static ID id_call;
|
26
|
+
static ID id_new;
|
27
|
+
|
24
28
|
VALUE
|
25
29
|
rb_grn_record_expression_builder_new (VALUE table, VALUE name)
|
26
30
|
{
|
27
31
|
return rb_funcall(rb_cGrnRecordExpressionBuilder,
|
28
|
-
|
32
|
+
id_new, 2, table, name);
|
29
33
|
}
|
30
34
|
|
31
35
|
VALUE
|
32
36
|
rb_grn_column_expression_builder_new (VALUE column, VALUE name, VALUE query)
|
33
37
|
{
|
34
38
|
return rb_funcall(rb_cGrnColumnExpressionBuilder,
|
35
|
-
|
36
|
-
}
|
37
|
-
|
38
|
-
static VALUE
|
39
|
-
build (VALUE self)
|
40
|
-
{
|
41
|
-
return rb_funcall(self, rb_intern("build"), 0);
|
39
|
+
id_new, 3, column, name, query);
|
42
40
|
}
|
43
41
|
|
44
42
|
static VALUE
|
45
43
|
build_block (RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
|
46
44
|
{
|
47
|
-
return rb_funcall(rb_block_proc(),
|
45
|
+
return rb_funcall(rb_block_proc(), id_call, 1, yielded_arg);
|
48
46
|
}
|
49
47
|
|
50
48
|
VALUE
|
51
49
|
rb_grn_record_expression_builder_build (VALUE self)
|
52
50
|
{
|
53
51
|
if (rb_block_given_p())
|
54
|
-
return
|
52
|
+
return rb_block_call(self, id_build, 0, NULL, build_block, self);
|
55
53
|
else
|
56
|
-
return
|
54
|
+
return rb_funcall(self, id_build, 0);
|
57
55
|
}
|
58
56
|
|
59
57
|
VALUE
|
60
58
|
rb_grn_column_expression_builder_build (VALUE self)
|
61
59
|
{
|
62
60
|
if (rb_block_given_p())
|
63
|
-
return
|
61
|
+
return rb_block_call(self, id_build, 0, NULL, build_block, self);
|
64
62
|
else
|
65
|
-
return
|
63
|
+
return rb_funcall(self, id_build, 0);
|
66
64
|
}
|
67
65
|
|
68
66
|
void
|
69
67
|
rb_grn_init_expression_builder (VALUE mGrn)
|
70
68
|
{
|
69
|
+
id_build = rb_intern("build");
|
70
|
+
id_call = rb_intern("call");
|
71
|
+
id_new = rb_intern("new");
|
72
|
+
|
71
73
|
rb_cGrnRecordExpressionBuilder =
|
72
74
|
rb_const_get(mGrn, rb_intern("RecordExpressionBuilder"));
|
73
75
|
rb_cGrnColumnExpressionBuilder =
|
@@ -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-2022 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
6
6
|
|
@@ -881,27 +881,6 @@ rb_grn_index_column_with_section_p (VALUE self)
|
|
881
881
|
return CBOOL2RVAL(flags & GRN_OBJ_WITH_SECTION);
|
882
882
|
}
|
883
883
|
|
884
|
-
/*
|
885
|
-
* _column_ がウェイト情報も格納する場合は +true+ を返します。
|
886
|
-
*
|
887
|
-
* @overload with_weight?
|
888
|
-
*/
|
889
|
-
static VALUE
|
890
|
-
rb_grn_index_column_with_weight_p (VALUE self)
|
891
|
-
{
|
892
|
-
grn_obj *column;
|
893
|
-
grn_ctx *context;
|
894
|
-
grn_column_flags flags;
|
895
|
-
|
896
|
-
rb_grn_index_column_deconstruct(SELF(self), &column, &context,
|
897
|
-
NULL, NULL,
|
898
|
-
NULL, NULL, NULL, NULL, NULL,
|
899
|
-
NULL, NULL);
|
900
|
-
|
901
|
-
flags = grn_column_get_flags(context, column);
|
902
|
-
return CBOOL2RVAL(flags & GRN_OBJ_WITH_WEIGHT);
|
903
|
-
}
|
904
|
-
|
905
884
|
/*
|
906
885
|
* _column_ が位置情報も格納する場合は +true+ を返します。
|
907
886
|
*
|
@@ -1460,8 +1439,6 @@ rb_grn_init_index_column (VALUE mGrn)
|
|
1460
1439
|
|
1461
1440
|
rb_define_method(rb_cGrnIndexColumn, "with_section?",
|
1462
1441
|
rb_grn_index_column_with_section_p, 0);
|
1463
|
-
rb_define_method(rb_cGrnIndexColumn, "with_weight?",
|
1464
|
-
rb_grn_index_column_with_weight_p, 0);
|
1465
1442
|
rb_define_method(rb_cGrnIndexColumn, "with_position?",
|
1466
1443
|
rb_grn_index_column_with_position_p, 0);
|
1467
1444
|
rb_define_method(rb_cGrnIndexColumn, "small?",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2017-
|
3
|
+
Copyright (C) 2017-2022 Sutou Kouhei <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
|
@@ -56,6 +56,15 @@ static const rb_data_type_t rb_grn_inverted_index_cursor_type = {
|
|
56
56
|
RUBY_TYPED_FREE_IMMEDIATELY,
|
57
57
|
};
|
58
58
|
|
59
|
+
static VALUE
|
60
|
+
rb_grn_inverted_index_cursor_alloc (VALUE klass)
|
61
|
+
{
|
62
|
+
return TypedData_Wrap_Struct(klass,
|
63
|
+
&rb_grn_inverted_index_cursor_type,
|
64
|
+
NULL);
|
65
|
+
}
|
66
|
+
|
67
|
+
|
59
68
|
VALUE
|
60
69
|
rb_grn_inverted_index_cursor_to_ruby_object (grn_ctx *context,
|
61
70
|
grn_ii_cursor *cursor,
|
@@ -256,6 +265,8 @@ rb_grn_init_inverted_index_cursor (VALUE mGrn)
|
|
256
265
|
{
|
257
266
|
rb_cGrnInvertedIndexCursor =
|
258
267
|
rb_define_class_under(mGrn, "InvertedIndexCursor", rb_cObject);
|
268
|
+
rb_define_alloc_func(rb_cGrnInvertedIndexCursor,
|
269
|
+
rb_grn_inverted_index_cursor_alloc);
|
259
270
|
rb_include_module(rb_cGrnInvertedIndexCursor, rb_mEnumerable);
|
260
271
|
|
261
272
|
rb_define_method(rb_cGrnInvertedIndexCursor, "next",
|
data/ext/groonga/rb-grn-object.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-2022 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2014-2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
6
6
|
|
@@ -927,6 +927,30 @@ rb_grn_object_inspect_content_flags_with_label (VALUE inspected,
|
|
927
927
|
rb_ary_push(inspected_flags, rb_str_new_cstr("COLUMN_SCALAR"));
|
928
928
|
} else if (column_flags & GRN_OBJ_COLUMN_VECTOR) {
|
929
929
|
rb_ary_push(inspected_flags, rb_str_new_cstr("COLUMN_VECTOR"));
|
930
|
+
if (column_flags & GRN_OBJ_WITH_WEIGHT)
|
931
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_WEIGHT"));
|
932
|
+
if (column_flags & GRN_OBJ_WEIGHT_FLOAT32)
|
933
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("WEIGHT_FLOAT32"));
|
934
|
+
}
|
935
|
+
switch (column_flags & GRN_OBJ_MISSING_MASK) {
|
936
|
+
case GRN_OBJ_MISSING_IGNORE:
|
937
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("MISSING_IGNORE"));
|
938
|
+
break;
|
939
|
+
case GRN_OBJ_MISSING_NIL:
|
940
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("MISSING_NIL"));
|
941
|
+
break;
|
942
|
+
default:
|
943
|
+
break;
|
944
|
+
}
|
945
|
+
switch (column_flags & GRN_OBJ_INVALID_MASK) {
|
946
|
+
case GRN_OBJ_INVALID_WARN:
|
947
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("INVALID_WARN"));
|
948
|
+
break;
|
949
|
+
case GRN_OBJ_INVALID_IGNORE:
|
950
|
+
rb_ary_push(inspected_flags, rb_str_new_cstr("INVALID_IGNORE"));
|
951
|
+
break;
|
952
|
+
default:
|
953
|
+
break;
|
930
954
|
}
|
931
955
|
break;
|
932
956
|
default:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/* vim: set sts=4 sw=4 ts=8 noet: */
|
3
3
|
/*
|
4
|
-
Copyright (C) 2009-
|
4
|
+
Copyright (C) 2009-2022 Sutou Kouhei <kou@clear-code.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
7
7
|
modify it under the terms of the GNU Lesser General Public
|
@@ -129,11 +129,45 @@ VALUE rb_cGrnPatriciaTrie;
|
|
129
129
|
*
|
130
130
|
* 省略した場合はShortText型をキーとして使用する。この場合、
|
131
131
|
* 4096バイトまで使用可能である。
|
132
|
+
*
|
133
|
+
* @option options :key_size (nil) The key size in bytes or the
|
134
|
+
* max key size in bytes. If `key_variable_size: true` is also
|
135
|
+
* specified, the size is the max key size not the key size.
|
136
|
+
*
|
137
|
+
* This is used only when the `:context` isn't associated with a
|
138
|
+
* database. If `:context` is associated with a database, this
|
139
|
+
* value is ignored.
|
140
|
+
*
|
141
|
+
* @see :key_type
|
142
|
+
* @see :key_variable_size
|
143
|
+
* @since 12.0.8
|
144
|
+
*
|
145
|
+
* @option options :key_variable_size (false) Whether the key is
|
146
|
+
* variable size or not.
|
147
|
+
*
|
148
|
+
* This is used only when the `:context` isn't associated with a
|
149
|
+
* database. If `:context` is associated with a database, this
|
150
|
+
* value is ignored.
|
151
|
+
*
|
152
|
+
* @see :key_type
|
153
|
+
* @see :key_size
|
154
|
+
* @since 12.0.8
|
155
|
+
*
|
132
156
|
* @option options :value_type
|
133
157
|
* 値の型を指定する。省略すると値のための領域を確保しない。
|
134
158
|
* 値を保存したい場合は必ず指定すること。
|
135
159
|
*
|
136
160
|
* 参考: {Groonga::Type.new}
|
161
|
+
*
|
162
|
+
* @option options :value_size (nil) The value size in bytes.
|
163
|
+
*
|
164
|
+
* This is used only when the `:context` isn't associated with a
|
165
|
+
* database. If `:context` is associated with a database, this
|
166
|
+
* value is ignored.
|
167
|
+
*
|
168
|
+
* @see :value_type
|
169
|
+
* @since 12.0.8
|
170
|
+
*
|
137
171
|
* @option options :default_tokenizer
|
138
172
|
* {Groonga::IndexColumn} で使用するトークナイザを指定する。
|
139
173
|
* デフォルトでは何も設定されていないので、テーブルに
|
@@ -170,7 +204,10 @@ rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
|
|
170
204
|
VALUE rb_table;
|
171
205
|
VALUE options, rb_context, rb_name, rb_path, rb_persistent;
|
172
206
|
VALUE rb_key_normalize, rb_key_with_sis, rb_key_type;
|
207
|
+
VALUE rb_key_size;
|
208
|
+
VALUE rb_key_variable_size;
|
173
209
|
VALUE rb_value_type;
|
210
|
+
VALUE rb_value_size;
|
174
211
|
VALUE rb_default_tokenizer;
|
175
212
|
VALUE rb_token_filters;
|
176
213
|
VALUE rb_sub_records;
|
@@ -186,7 +223,10 @@ rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
|
|
186
223
|
"key_normalize", &rb_key_normalize,
|
187
224
|
"key_with_sis", &rb_key_with_sis,
|
188
225
|
"key_type", &rb_key_type,
|
226
|
+
"key_size", &rb_key_size,
|
227
|
+
"key_variable_size", &rb_key_variable_size,
|
189
228
|
"value_type", &rb_value_type,
|
229
|
+
"value_size", &rb_value_size,
|
190
230
|
"default_tokenizer", &rb_default_tokenizer,
|
191
231
|
"token_filters", &rb_token_filters,
|
192
232
|
"sub_records", &rb_sub_records,
|
@@ -227,10 +267,26 @@ rb_grn_patricia_trie_s_create (int argc, VALUE *argv, VALUE klass)
|
|
227
267
|
if (RVAL2CBOOL(rb_sub_records))
|
228
268
|
flags |= GRN_OBJ_WITH_SUBREC;
|
229
269
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
270
|
+
if (grn_ctx_db(context)) {
|
271
|
+
table = grn_table_create(context, name, name_size, path,
|
272
|
+
flags, key_type, value_type);
|
273
|
+
if (!table)
|
274
|
+
rb_grn_context_check(context, rb_ary_new_from_values(argc, argv));
|
275
|
+
} else {
|
276
|
+
unsigned int key_size = NUM2UINT(rb_key_size);
|
277
|
+
unsigned int value_size =
|
278
|
+
RB_NIL_P(rb_value_size) ? 0 : NUM2UINT(rb_value_size);
|
279
|
+
if (RVAL2CBOOL(rb_key_variable_size)) {
|
280
|
+
flags |= GRN_OBJ_KEY_VAR_SIZE;
|
281
|
+
}
|
282
|
+
table = (grn_obj *)grn_pat_create(context,
|
283
|
+
path,
|
284
|
+
key_size,
|
285
|
+
value_size,
|
286
|
+
flags);
|
287
|
+
if (!table)
|
288
|
+
rb_grn_context_check(context, rb_ary_new_from_values(argc, argv));
|
289
|
+
}
|
234
290
|
rb_table = GRNOBJECT2RVAL(klass, context, table, GRN_TRUE);
|
235
291
|
|
236
292
|
if (!NIL_P(rb_default_tokenizer))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2016-
|
3
|
+
Copyright (C) 2016-2022 Sutou Kouhei <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
|
@@ -38,6 +38,12 @@ static rb_data_type_t data_type = {
|
|
38
38
|
0
|
39
39
|
};
|
40
40
|
|
41
|
+
static VALUE
|
42
|
+
rb_grn_request_timer_id_alloc (VALUE klass)
|
43
|
+
{
|
44
|
+
return TypedData_Wrap_Struct(klass, &data_type, NULL);
|
45
|
+
}
|
46
|
+
|
41
47
|
void *
|
42
48
|
rb_grn_request_timer_id_from_ruby_object (VALUE rb_id)
|
43
49
|
{
|
@@ -61,4 +67,6 @@ rb_grn_init_request_timer_id (VALUE mGrn)
|
|
61
67
|
{
|
62
68
|
rb_cGrnRequestTimerID =
|
63
69
|
rb_define_class_under(mGrn, "RequestTimerID", rb_cObject);
|
70
|
+
rb_define_alloc_func(rb_cGrnRequestTimerID,
|
71
|
+
rb_grn_request_timer_id_alloc);
|
64
72
|
}
|
@@ -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-2022 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2014-2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
@@ -344,7 +344,7 @@ rb_grn_table_key_support_get_key (VALUE self, VALUE rb_id)
|
|
344
344
|
if (key_size == 0)
|
345
345
|
return Qnil;
|
346
346
|
|
347
|
-
if (GRN_BULK_VSIZE(key) < key_size) {
|
347
|
+
if (GRN_BULK_VSIZE(key) < (size_t)key_size) {
|
348
348
|
grn_bulk_reserve(context, key, key_size);
|
349
349
|
grn_table_get_key(context, table, id, GRN_BULK_HEAD(key), key_size);
|
350
350
|
}
|
@@ -540,7 +540,11 @@ rb_grn_table_key_support_array_set (VALUE self, VALUE rb_key, VALUE rb_values)
|
|
540
540
|
data.id = id;
|
541
541
|
data.table = table;
|
542
542
|
data.rb_grn_object.context = context;
|
543
|
-
|
543
|
+
{
|
544
|
+
ID id_each;
|
545
|
+
CONST_ID(id_each, "each");
|
546
|
+
rb_block_call(rb_values, id_each, 0, NULL, set_value, (VALUE)&data);
|
547
|
+
}
|
544
548
|
|
545
549
|
return Qnil;
|
546
550
|
}
|