rroonga 1.1.0 → 1.2.0
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.
- data/NEWS.ja.rdoc +18 -0
- data/NEWS.rdoc +18 -0
- data/bin/grndump +71 -0
- data/ext/groonga/rb-grn-accessor.c +64 -1
- data/ext/groonga/rb-grn-context.c +40 -1
- data/ext/groonga/rb-grn-database.c +47 -5
- data/ext/groonga/rb-grn-index-column.c +77 -7
- data/ext/groonga/rb-grn-object.c +8 -4
- data/ext/groonga/rb-grn-table-cursor.c +56 -1
- data/ext/groonga/rb-grn-table-key-support.c +2 -2
- data/ext/groonga/rb-grn-table.c +10 -38
- data/ext/groonga/rb-grn.h +11 -1
- data/html/index.html +6 -6
- data/html/ranguba.css +8 -1
- data/lib/groonga.rb +1 -0
- data/lib/groonga/dumper.rb +481 -0
- data/lib/groonga/schema.rb +54 -181
- data/rroonga-build.rb +1 -1
- data/test-unit-notify/Rakefile +47 -0
- data/test-unit-notify/lib/test/unit/notify.rb +104 -0
- data/test-unit/COPYING +56 -0
- data/test-unit/GPL +340 -0
- data/test-unit/PSFL +271 -0
- data/test-unit/Rakefile +18 -5
- data/test-unit/html/bar.svg +153 -0
- data/test-unit/html/developer.svg +469 -0
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.svg +82 -0
- data/test-unit/html/heading-mark.svg +393 -0
- data/test-unit/html/index.html +235 -13
- data/test-unit/html/index.html.ja +258 -15
- data/test-unit/html/install.svg +636 -0
- data/test-unit/html/logo.svg +483 -0
- data/test-unit/html/test-unit.css +339 -0
- data/test-unit/html/tutorial.svg +559 -0
- data/test-unit/lib/test/unit.rb +6 -1
- data/test-unit/lib/test/unit/assertions.rb +115 -11
- data/test-unit/lib/test/unit/autorunner.rb +5 -2
- data/test-unit/lib/test/unit/collector/load.rb +1 -1
- data/test-unit/lib/test/unit/color-scheme.rb +6 -2
- data/test-unit/lib/test/unit/diff.rb +17 -1
- data/test-unit/lib/test/unit/testcase.rb +7 -0
- data/test-unit/lib/test/unit/testresult.rb +34 -2
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +9 -45
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +2 -12
- data/test-unit/lib/test/unit/ui/testrunner.rb +25 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +1 -0
- data/test-unit/lib/test/unit/util/output.rb +31 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/test/test-color-scheme.rb +4 -2
- data/test-unit/test/test_assertions.rb +51 -5
- data/test-unit/test/ui/test_tap.rb +33 -0
- data/test-unit/test/util/test-output.rb +11 -0
- data/test/groonga-test-utils.rb +1 -0
- data/test/test-accessor.rb +32 -0
- data/test/test-context.rb +7 -1
- data/test/test-database-dumper.rb +156 -0
- data/test/test-index-column.rb +67 -1
- data/test/test-schema-dumper.rb +181 -0
- data/test/test-schema.rb +53 -97
- data/test/test-table-dumper.rb +83 -0
- metadata +48 -11
- data/ext/groonga/mkmf.log +0 -99
- data/test-unit/html/classic.html +0 -15
data/NEWS.ja.rdoc
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
= お知らせ
|
2
2
|
|
3
|
+
== 1.2.0: 2011-04-01
|
4
|
+
|
5
|
+
=== 改良
|
6
|
+
|
7
|
+
* groonga 1.2.0対応。
|
8
|
+
* Groonga::Accessor#local_nameを追加。
|
9
|
+
* Groonga::IndexColumn#with_section?を追加。
|
10
|
+
* Groonga::IndexColumn#with_weight?を追加。
|
11
|
+
* Groonga::IndexColumn#with_position?を追加。
|
12
|
+
* Groonga::Schema.dumpがgroongaコマンド形式でのダンプに対応。
|
13
|
+
* grndumpを追加。
|
14
|
+
* Groonga::Database#eachで繰り返す順序を指定可能にした。
|
15
|
+
* Groonga::Context#match_escalation_thresholdを追加。
|
16
|
+
* Groonga::Context#match_escalation_threshold=を追加。
|
17
|
+
* エラーメッセージの改良。
|
18
|
+
* Groonga::Schemaの型指定で"ShortText"など正式型名だけではなく、
|
19
|
+
:short_textなどよりRubyらしい名前を使えるようにした。
|
20
|
+
|
3
21
|
== 1.1.0: 2011-02-09
|
4
22
|
|
5
23
|
=== 改良
|
data/NEWS.rdoc
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
= NEWS
|
2
2
|
|
3
|
+
== 1.2.0: 2011-04-01
|
4
|
+
|
5
|
+
=== Improvements
|
6
|
+
|
7
|
+
* Supported groonga 1.2.0.
|
8
|
+
* Added Groonga::Accessor#local_name.
|
9
|
+
* Added Groonga::IndexColumn#with_section?.
|
10
|
+
* Added Groonga::IndexColumn#with_weight?.
|
11
|
+
* Added Groonga::IndexColumn#with_position?.
|
12
|
+
* Groonga::Schema.dump supported groonga command format dump.
|
13
|
+
* Added grndump command.
|
14
|
+
* Groonga::Database#each supports order customize.
|
15
|
+
* Added Groonga::Context#match_escalation_threshold.
|
16
|
+
* Added Groonga::Context#match_escalation_threshold=.
|
17
|
+
* Improved error message.
|
18
|
+
* Supported Rubyish name like :short_text instead of the
|
19
|
+
official type name like "ShortText" in Groonga::Schema.
|
20
|
+
|
3
21
|
== 1.1.0: 2011-02-09
|
4
22
|
|
5
23
|
=== Improvements
|
data/bin/grndump
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License version 2.1 as published by the Free Software Foundation.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
+
|
19
|
+
require 'ostruct'
|
20
|
+
require 'optparse'
|
21
|
+
require 'pathname'
|
22
|
+
|
23
|
+
require 'groonga'
|
24
|
+
|
25
|
+
options = OpenStruct.new
|
26
|
+
options.tables = []
|
27
|
+
options.dump_schema = true
|
28
|
+
options.dump_tables = true
|
29
|
+
option_parser = OptionParser.new do |parser|
|
30
|
+
parser.banner += " DB_PATH"
|
31
|
+
|
32
|
+
parser.on("--no-dump-schema",
|
33
|
+
"don't dump schema.") do |boolean|
|
34
|
+
options.dump_schema = boolean
|
35
|
+
end
|
36
|
+
|
37
|
+
parser.on("--no-dump-tables",
|
38
|
+
"don't dump tables.") do |boolean|
|
39
|
+
options.dump_tables = boolean
|
40
|
+
end
|
41
|
+
|
42
|
+
parser.on("-t=TABLE", "--table=TABLE",
|
43
|
+
"dump only TABLE.",
|
44
|
+
"use this option multiple to dump multiple tables.",
|
45
|
+
"use /.../ as TABLE to match table name with regexp.") do |table|
|
46
|
+
case table
|
47
|
+
when /\A\/(.*)\/(i)?\z/
|
48
|
+
options.tables << Regexp.new($1, $2 == "i")
|
49
|
+
when
|
50
|
+
options.tables << table
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
args = option_parser.parse!(ARGV)
|
55
|
+
|
56
|
+
if args.size != 1
|
57
|
+
puts(option_parser)
|
58
|
+
exit(false)
|
59
|
+
end
|
60
|
+
db_path = args[0]
|
61
|
+
|
62
|
+
database = Groonga::Database.open(db_path)
|
63
|
+
dumper_options = {
|
64
|
+
:database => database,
|
65
|
+
:output => STDOUT,
|
66
|
+
:dump_schema => options.dump_schema,
|
67
|
+
:dump_tables => options.dump_tables,
|
68
|
+
:tables => options.tables,
|
69
|
+
}
|
70
|
+
database_dumper = Groonga::DatabaseDumper.new(dumper_options)
|
71
|
+
database_dumper.dump
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
20
20
|
|
21
|
-
#define SELF(object) (
|
21
|
+
#define SELF(object) ((RbGrnAccessor *)DATA_PTR(object))
|
22
22
|
|
23
23
|
VALUE rb_cGrnAccessor;
|
24
24
|
|
@@ -39,6 +39,66 @@ rb_grn_accessor_to_ruby_object (grn_ctx *context, grn_obj *table,
|
|
39
39
|
return GRNOBJECT2RVAL(rb_cGrnAccessor, context, table, owner);
|
40
40
|
}
|
41
41
|
|
42
|
+
void
|
43
|
+
rb_grn_accessor_bind (RbGrnAccessor *rb_accessor,
|
44
|
+
grn_ctx *context, grn_obj *accessor)
|
45
|
+
{
|
46
|
+
RbGrnObject *rb_grn_object;
|
47
|
+
RbGrnNamedObject *rb_grn_named_object;
|
48
|
+
char name[GRN_TABLE_MAX_KEY_SIZE];
|
49
|
+
int name_size;
|
50
|
+
|
51
|
+
rb_grn_object = RB_GRN_OBJECT(rb_accessor);
|
52
|
+
rb_grn_named_object = RB_GRN_NAMED_OBJECT(rb_accessor);
|
53
|
+
rb_grn_named_object_bind(rb_grn_named_object, context, accessor);
|
54
|
+
|
55
|
+
name_size = grn_column_name(context, accessor, name, sizeof(name));
|
56
|
+
if (name_size > 0) {
|
57
|
+
rb_grn_named_object_set_name(rb_grn_named_object, name, name_size);
|
58
|
+
}
|
59
|
+
|
60
|
+
rb_accessor->value = grn_obj_open(context, GRN_BULK, 0,
|
61
|
+
rb_grn_object->range_id);
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
void
|
66
|
+
rb_grn_accessor_finalizer (grn_ctx *context, grn_obj *grn_object,
|
67
|
+
RbGrnAccessor *rb_accessor)
|
68
|
+
{
|
69
|
+
rb_grn_named_object_finalizer(context, grn_object,
|
70
|
+
RB_GRN_NAMED_OBJECT(rb_accessor));
|
71
|
+
if (context && rb_accessor->value)
|
72
|
+
grn_obj_unlink(context, rb_accessor->value);
|
73
|
+
rb_accessor->value = NULL;
|
74
|
+
}
|
75
|
+
|
76
|
+
/*
|
77
|
+
* call-seq:
|
78
|
+
* accessor.local_name
|
79
|
+
*
|
80
|
+
* アクセサ名を返す。
|
81
|
+
*
|
82
|
+
* items = Groonga::Array.create(:name => "Items")
|
83
|
+
* id = items.column("_id")
|
84
|
+
* id.name # => nil
|
85
|
+
* id.local_name # => "_id"
|
86
|
+
*/
|
87
|
+
static VALUE
|
88
|
+
rb_grn_accessor_get_local_name (VALUE self)
|
89
|
+
{
|
90
|
+
RbGrnAccessor *rb_grn_accessor;
|
91
|
+
RbGrnNamedObject *rb_grn_named_object;
|
92
|
+
|
93
|
+
rb_grn_accessor = SELF(self);
|
94
|
+
rb_grn_named_object = RB_GRN_NAMED_OBJECT(rb_grn_accessor);
|
95
|
+
if (rb_grn_named_object->name_size == 0)
|
96
|
+
return Qnil;
|
97
|
+
|
98
|
+
return rb_str_new(rb_grn_named_object->name,
|
99
|
+
rb_grn_named_object->name_size);
|
100
|
+
}
|
101
|
+
|
42
102
|
/*
|
43
103
|
* Document-class: Groonga::Accessor < Groonga::Object
|
44
104
|
*
|
@@ -49,4 +109,7 @@ void
|
|
49
109
|
rb_grn_init_accessor (VALUE mGrn)
|
50
110
|
{
|
51
111
|
rb_cGrnAccessor = rb_define_class_under(mGrn, "Accessor", rb_cGrnObject);
|
112
|
+
|
113
|
+
rb_define_method(rb_cGrnAccessor, "local_name",
|
114
|
+
rb_grn_accessor_get_local_name, 0);
|
52
115
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
Copyright (C) 2010-2011 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
|
@@ -422,6 +422,41 @@ rb_grn_context_set_encoding (VALUE self, VALUE rb_encoding)
|
|
422
422
|
return rb_encoding;
|
423
423
|
}
|
424
424
|
|
425
|
+
/*
|
426
|
+
* call-seq:
|
427
|
+
* context.match_escalation_threshold -> Integer
|
428
|
+
*
|
429
|
+
* このコンテキストを使って検索したときに検索の挙動をエスカレー
|
430
|
+
* ションする閾値を返します。エスカレーションの詳細はgroonga
|
431
|
+
* の検索の仕様に関するドキュメントを参照してください。
|
432
|
+
* http://groonga.org/docs/spec/search.html#spec-search
|
433
|
+
*/
|
434
|
+
static VALUE
|
435
|
+
rb_grn_context_get_match_escalation_threshold (VALUE self)
|
436
|
+
{
|
437
|
+
return LL2NUM(grn_ctx_get_match_escalation_threshold(SELF(self)));
|
438
|
+
}
|
439
|
+
|
440
|
+
/*
|
441
|
+
* call-seq:
|
442
|
+
* context.match_escalation_threshold=(match_escalation_threshold)
|
443
|
+
*
|
444
|
+
* このコンテキストを使って検索したときに検索の挙動をエスカレー
|
445
|
+
* ションする閾値を設定します。エスカレーションの詳細はgroonga
|
446
|
+
* の検索の仕様に関するドキュメントを参照してください。
|
447
|
+
* http://groonga.org/docs/spec/search.html#spec-search
|
448
|
+
*/
|
449
|
+
static VALUE
|
450
|
+
rb_grn_context_set_match_escalation_threshold (VALUE self, VALUE threshold)
|
451
|
+
{
|
452
|
+
grn_ctx *context;
|
453
|
+
|
454
|
+
context = SELF(self);
|
455
|
+
grn_ctx_set_match_escalation_threshold(context, NUM2LL(threshold));
|
456
|
+
|
457
|
+
return threshold;
|
458
|
+
}
|
459
|
+
|
425
460
|
/*
|
426
461
|
* call-seq:
|
427
462
|
* context.support_zlib?
|
@@ -732,6 +767,10 @@ rb_grn_init_context (VALUE mGrn)
|
|
732
767
|
|
733
768
|
rb_define_method(cGrnContext, "encoding", rb_grn_context_get_encoding, 0);
|
734
769
|
rb_define_method(cGrnContext, "encoding=", rb_grn_context_set_encoding, 1);
|
770
|
+
rb_define_method(cGrnContext, "match_escalation_threshold",
|
771
|
+
rb_grn_context_get_match_escalation_threshold, 0);
|
772
|
+
rb_define_method(cGrnContext, "match_escalation_threshold=",
|
773
|
+
rb_grn_context_set_match_escalation_threshold, 1);
|
735
774
|
|
736
775
|
rb_define_method(cGrnContext, "support_zlib?",
|
737
776
|
rb_grn_context_support_zlib_p, 0);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2011 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
|
@@ -287,27 +287,69 @@ rb_grn_database_s_open (int argc, VALUE *argv, VALUE klass)
|
|
287
287
|
/*
|
288
288
|
* call-seq:
|
289
289
|
* database.each {|object| ...}
|
290
|
+
* database.each(options=nil) {|object| ...}
|
290
291
|
*
|
291
292
|
* データベース内のオブジェクトを順番にブロックに渡す。
|
292
293
|
*
|
294
|
+
* _options_にはハッシュでオプションを指定する。指定できるオ
|
295
|
+
* プションは以下の通り。
|
296
|
+
*
|
297
|
+
* [+:order+]
|
298
|
+
* +:asc+または+:ascending+を指定すると昇順にレコードを取
|
299
|
+
* り出す。(デフォルト)
|
300
|
+
*
|
301
|
+
* +:desc+または+:descending+を指定すると降順にレコードを
|
302
|
+
* 取り出す。
|
303
|
+
*
|
304
|
+
* [+:order_by+]
|
305
|
+
* +:id+を指定するとID順にレコードを取り出す。
|
306
|
+
*
|
307
|
+
* +:key+指定するとキー順にレコードを取り出す。(デフォル
|
308
|
+
* ト)
|
309
|
+
*
|
293
310
|
* すべてのオブジェクトの名前を表示する:
|
294
311
|
* database.each do |object|
|
295
312
|
* p object.name
|
296
313
|
* end
|
314
|
+
*
|
315
|
+
* すべてのオブジェクトの名前をID順で表示する:
|
316
|
+
* database.each(:order_by => :id) do |object|
|
317
|
+
* p object.name
|
318
|
+
* end
|
319
|
+
*
|
320
|
+
* すべてのオブジェクトの名前をキー名の降順で表示する:
|
321
|
+
* database.each(:order_by => :key, :order => :desc) do |object|
|
322
|
+
* p object.name
|
323
|
+
* end
|
297
324
|
*/
|
298
325
|
static VALUE
|
299
|
-
rb_grn_database_each (VALUE self)
|
326
|
+
rb_grn_database_each (int argc, VALUE *argv, VALUE self)
|
300
327
|
{
|
301
328
|
grn_ctx *context = NULL;
|
302
329
|
grn_obj *database;
|
303
330
|
grn_table_cursor *cursor;
|
304
|
-
VALUE rb_cursor;
|
331
|
+
VALUE rb_cursor, rb_options, rb_order, rb_order_by;
|
332
|
+
int flags = 0;
|
305
333
|
grn_id id;
|
306
334
|
|
307
335
|
rb_grn_database_deconstruct(SELF(self), &database, &context,
|
308
336
|
NULL, NULL, NULL, NULL);
|
337
|
+
|
338
|
+
rb_scan_args(argc, argv, "01", &rb_options);
|
339
|
+
|
340
|
+
rb_grn_scan_options(rb_options,
|
341
|
+
"order", &rb_order,
|
342
|
+
"order_by", &rb_order_by,
|
343
|
+
NULL);
|
344
|
+
|
345
|
+
flags |= rb_grn_table_cursor_order_to_flag(rb_order);
|
346
|
+
flags |= rb_grn_table_cursor_order_by_to_flag(GRN_TABLE_PAT_KEY,
|
347
|
+
self,
|
348
|
+
rb_order_by);
|
349
|
+
|
309
350
|
cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
|
310
|
-
0, -1,
|
351
|
+
0, -1,
|
352
|
+
flags);
|
311
353
|
rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
|
312
354
|
rb_iv_set(self, "cursor", rb_cursor);
|
313
355
|
while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
|
@@ -480,7 +522,7 @@ rb_grn_init_database (VALUE mGrn)
|
|
480
522
|
rb_grn_database_initialize, -1);
|
481
523
|
|
482
524
|
rb_define_method(rb_cGrnDatabase, "each",
|
483
|
-
rb_grn_database_each,
|
525
|
+
rb_grn_database_each, -1);
|
484
526
|
|
485
527
|
rb_define_method(rb_cGrnDatabase, "close",
|
486
528
|
rb_grn_database_close, 0);
|
@@ -400,26 +400,26 @@ rb_grn_index_column_set_source (VALUE self, VALUE rb_source)
|
|
400
400
|
*
|
401
401
|
* 利用可能なオプションは以下の通り。
|
402
402
|
*
|
403
|
-
* [
|
403
|
+
* [+:result+]
|
404
404
|
* 結果を格納するGroonga::Hash。指定しない場合は新しく
|
405
405
|
* Groonga::Hashを生成し、それに結果を格納して返す。
|
406
|
-
* [
|
406
|
+
* [+:operator+]
|
407
407
|
* 以下のどれかの値を指定する。+nil+, <tt>"or"</tt>, <tt>"||"</tt>,
|
408
408
|
* <tt>"and"</tt>, <tt>"+"</tt>, <tt>"&&"</tt>, <tt>"but"</tt>,
|
409
409
|
* <tt>"not"</tt>, <tt>"-"</tt>, <tt>"adjust"</tt>, <tt>">"</tt>。
|
410
410
|
* それぞれ以下のようになる。(FIXME: 「以下」)
|
411
|
-
* [
|
411
|
+
* [+:exact+]
|
412
412
|
* +true+を指定すると完全一致で検索する
|
413
|
-
* [
|
413
|
+
* [+:longest_common_prefix+]
|
414
414
|
* +true+を指定すると_query_と同じ接頭辞をもつエントリのう
|
415
415
|
* ち、もっとも長いエントリを検索する
|
416
|
-
* [
|
416
|
+
* [+:suffix+]
|
417
417
|
* +true+を指定すると_query_が後方一致するエントリを検索す
|
418
418
|
* る
|
419
|
-
* [
|
419
|
+
* [+:prefix+]
|
420
420
|
* +true+を指定すると_query_が前方一致するレコードを検索す
|
421
421
|
* る
|
422
|
-
* [
|
422
|
+
* [+:near+]
|
423
423
|
* +true+を指定すると_query_に指定した複数の語が近傍に含ま
|
424
424
|
* れるレコードを検索する
|
425
425
|
* [...]
|
@@ -483,6 +483,69 @@ rb_grn_index_column_search (int argc, VALUE *argv, VALUE self)
|
|
483
483
|
return rb_result;
|
484
484
|
}
|
485
485
|
|
486
|
+
/*
|
487
|
+
* Document-method: with_section?
|
488
|
+
*
|
489
|
+
* call-seq:
|
490
|
+
* column.with_section? -> true/false
|
491
|
+
*
|
492
|
+
* _column_が段落情報も格納する場合は+true+を返します。
|
493
|
+
*/
|
494
|
+
static VALUE
|
495
|
+
rb_grn_index_column_with_section_p (VALUE self)
|
496
|
+
{
|
497
|
+
grn_obj *column;
|
498
|
+
|
499
|
+
rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
|
500
|
+
NULL, NULL,
|
501
|
+
NULL, NULL, NULL, NULL,
|
502
|
+
NULL, NULL);
|
503
|
+
|
504
|
+
return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_SECTION);
|
505
|
+
}
|
506
|
+
|
507
|
+
/*
|
508
|
+
* Document-method: with_weight?
|
509
|
+
*
|
510
|
+
* call-seq:
|
511
|
+
* column.with_weight? -> true/false
|
512
|
+
*
|
513
|
+
* _column_がウェイト情報も格納する場合は+true+を返します。
|
514
|
+
*/
|
515
|
+
static VALUE
|
516
|
+
rb_grn_index_column_with_weight_p (VALUE self)
|
517
|
+
{
|
518
|
+
grn_obj *column;
|
519
|
+
|
520
|
+
rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
|
521
|
+
NULL, NULL,
|
522
|
+
NULL, NULL, NULL, NULL,
|
523
|
+
NULL, NULL);
|
524
|
+
|
525
|
+
return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_WEIGHT);
|
526
|
+
}
|
527
|
+
|
528
|
+
/*
|
529
|
+
* Document-method: with_position?
|
530
|
+
*
|
531
|
+
* call-seq:
|
532
|
+
* column.with_position? -> true/false
|
533
|
+
*
|
534
|
+
* _column_が位置情報も格納する場合は+true+を返します。
|
535
|
+
*/
|
536
|
+
static VALUE
|
537
|
+
rb_grn_index_column_with_position_p (VALUE self)
|
538
|
+
{
|
539
|
+
grn_obj *column;
|
540
|
+
|
541
|
+
rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
|
542
|
+
NULL, NULL,
|
543
|
+
NULL, NULL, NULL, NULL,
|
544
|
+
NULL, NULL);
|
545
|
+
|
546
|
+
return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_POSITION);
|
547
|
+
}
|
548
|
+
|
486
549
|
void
|
487
550
|
rb_grn_init_index_column (VALUE mGrn)
|
488
551
|
{
|
@@ -501,4 +564,11 @@ rb_grn_init_index_column (VALUE mGrn)
|
|
501
564
|
|
502
565
|
rb_define_method(rb_cGrnIndexColumn, "search",
|
503
566
|
rb_grn_index_column_search, -1);
|
567
|
+
|
568
|
+
rb_define_method(rb_cGrnIndexColumn, "with_section?",
|
569
|
+
rb_grn_index_column_with_section_p, 0);
|
570
|
+
rb_define_method(rb_cGrnIndexColumn, "with_weight?",
|
571
|
+
rb_grn_index_column_with_weight_p, 0);
|
572
|
+
rb_define_method(rb_cGrnIndexColumn, "with_position?",
|
573
|
+
rb_grn_index_column_with_position_p, 0);
|
504
574
|
}
|