rroonga 0.9.4-x86-mingw32 → 0.9.5-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.ja.rdoc +29 -0
- data/NEWS.rdoc +29 -0
- data/Rakefile +6 -6
- data/ext/groonga/rb-grn-array.c +1 -1
- data/ext/groonga/rb-grn-context.c +15 -28
- data/ext/groonga/rb-grn-exception.c +46 -1
- data/ext/groonga/rb-grn-expression.c +22 -13
- data/ext/groonga/rb-grn-fix-size-column.c +2 -8
- data/ext/groonga/rb-grn-hash.c +8 -1
- data/ext/groonga/rb-grn-object.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +23 -1
- data/ext/groonga/rb-grn-table-key-support.c +22 -0
- data/ext/groonga/rb-grn-table.c +37 -5
- data/ext/groonga/rb-grn-utils.c +20 -2
- data/ext/groonga/rb-grn.h +1 -1
- data/ext/groonga/rb-groonga.c +76 -38
- data/extconf.rb +17 -1
- data/html/developer.html +32 -7
- data/html/footer.html.erb +5 -0
- data/html/heading-mark.svg +393 -0
- data/html/index.html +33 -3
- data/lib/1.8/groonga.so +0 -0
- data/lib/1.9/groonga.so +0 -0
- data/lib/groonga.rb +3 -7
- data/lib/groonga/context.rb +2 -13
- data/lib/groonga/expression-builder.rb +273 -67
- data/lib/groonga/pagination.rb +143 -0
- data/lib/groonga/record.rb +2 -0
- data/lib/groonga/schema.rb +140 -29
- data/pkg/rroonga-0.9.5/NEWS.ja.rdoc +156 -0
- data/pkg/rroonga-0.9.5/NEWS.rdoc +158 -0
- data/pkg/rroonga-0.9.5/README.ja.rdoc +65 -0
- data/pkg/rroonga-0.9.5/README.rdoc +66 -0
- data/pkg/rroonga-0.9.5/text/TUTORIAL.ja.rdoc +394 -0
- data/pkg/rroonga-0.9.5/text/expression.rdoc +285 -0
- data/rroonga-build.rb +2 -2
- data/test-unit/Rakefile +40 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/classic.html +15 -0
- data/test-unit/html/index.html +25 -0
- data/test-unit/html/index.html.ja +27 -0
- data/test-unit/lib/test/unit.rb +323 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1230 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +360 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +144 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +102 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +724 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +476 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +442 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +67 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1151 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/groonga-test-utils.rb +3 -2
- data/test/run-test.rb +14 -2
- data/test/test-column.rb +7 -7
- data/test/test-context-select.rb +34 -11
- data/test/test-exception.rb +3 -0
- data/test/test-expression-builder.rb +11 -0
- data/test/test-expression.rb +3 -6
- data/test/test-gqtp.rb +3 -5
- data/test/test-pagination.rb +249 -0
- data/test/test-record.rb +36 -8
- data/test/test-remote.rb +11 -4
- data/test/test-schema-create-table.rb +251 -0
- data/test/test-schema.rb +4 -24
- data/test/test-table-offset-and-limit.rb +3 -5
- data/test/test-table-select-mecab.rb +80 -0
- data/test/test-table-select-weight.rb +104 -0
- data/test/test-table.rb +22 -4
- data/test/test-version.rb +1 -1
- data/text/TUTORIAL.ja.rdoc +2 -0
- data/text/expression.rdoc +1 -0
- data/vendor/local/bin/grntest.exe +0 -0
- data/vendor/local/bin/groonga.exe +0 -0
- data/vendor/local/bin/libgroonga-0.dll +0 -0
- data/vendor/local/include/{groonga.h → groonga/groonga.h} +93 -32
- data/vendor/local/lib/groonga/modules/functions/cast.dll +0 -0
- data/vendor/local/lib/groonga/modules/functions/cast.la +41 -0
- data/vendor/local/lib/pkgconfig/groonga.pc +12 -0
- data/vendor/local/share/groonga/admin_html/css/admin.css +104 -0
- data/vendor/local/share/groonga/admin_html/css/ui-lightness/jquery-ui-1.8.1.custom.css +486 -0
- data/vendor/local/share/groonga/admin_html/index.html +1355 -0
- data/vendor/local/share/groonga/admin_html/js/jquery-1.4.2.min.js +154 -0
- data/vendor/local/share/groonga/admin_html/js/jquery-ui-1.8.1.custom.min.js +756 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_cpu_load +47 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_cpu_time +57 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_disk +162 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_memory +51 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_n_records +110 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_query_performance +133 -0
- data/vendor/local/share/groonga/munin/plugins/groonga_status +84 -0
- metadata +126 -36
data/NEWS.ja.rdoc
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
= お知らせ
|
2
2
|
|
3
|
+
== 0.9.5: 2010-07-29
|
4
|
+
|
5
|
+
* groonga 0.7.4対応。
|
6
|
+
* Groonga::Table#selectの改良:
|
7
|
+
* 重み付きマッチ対応:
|
8
|
+
|
9
|
+
sourceカラムとtitleカラムにマッチするが、
|
10
|
+
titleカラムの方がスコアが大きくなる例:
|
11
|
+
table.select do |record|
|
12
|
+
(record.title * 10 | record.source) =~ "query"
|
13
|
+
end
|
14
|
+
* 配列で複数条件のand表現に対応:
|
15
|
+
|
16
|
+
以下は同じ条件になる:
|
17
|
+
table.select do |record|
|
18
|
+
conditions = []
|
19
|
+
conditions << record.title =~ "query"
|
20
|
+
conditions << record.updated_at > Time.parse("2010-07-29T21:14:29+09:00")
|
21
|
+
conditions
|
22
|
+
end
|
23
|
+
|
24
|
+
table.select do |record|
|
25
|
+
(record.title =~ "query") &
|
26
|
+
(record.updated_at > Time.parse("2010-07-29T21:14:29+09:00"))
|
27
|
+
end
|
28
|
+
* 利用しているgroongaのバージョン取得対応: Groonga::VERSION
|
29
|
+
* Groonga::Table#support_sub_records?追加
|
30
|
+
* ページネーション対応: Groonga::Table#paginate, Groonga::Pagination
|
31
|
+
|
3
32
|
== 0.9.4: 2010-04-22
|
4
33
|
|
5
34
|
* リリースミス修正。
|
data/NEWS.rdoc
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
= NEWS
|
2
2
|
|
3
|
+
== 0.9.5: 2010-07-20
|
4
|
+
|
5
|
+
* Supported groonga 0.7.4.
|
6
|
+
* Imporoved Groonga::Table#select:
|
7
|
+
* Supported weight match:
|
8
|
+
|
9
|
+
Here is an example to match source column or title column and
|
10
|
+
title column has high score:
|
11
|
+
table.select do |record|
|
12
|
+
(record.title * 10 | record.source) =~ "query"
|
13
|
+
end
|
14
|
+
* Supported and representation for and conditions:
|
15
|
+
|
16
|
+
Here are examples that represents the same condition:
|
17
|
+
table.select do |record|
|
18
|
+
conditions = []
|
19
|
+
conditions << record.title =~ "query"
|
20
|
+
conditions << record.updated_at > Time.parse("2010-07-29T21:14:29+09:00")
|
21
|
+
conditions
|
22
|
+
end
|
23
|
+
|
24
|
+
table.select do |record|
|
25
|
+
(record.title =~ "query") &
|
26
|
+
(record.updated_at > Time.parse("2010-07-29T21:14:29+09:00"))
|
27
|
+
end
|
28
|
+
* Provided groonga runtime version: Groonga::VERSION
|
29
|
+
* Added Groonga::Table#support_sub_records?
|
30
|
+
* Supported pagination: Groonga::Table#paginate, Groonga::Pagination
|
31
|
+
|
3
32
|
== 0.9.4: 2010-04-22
|
4
33
|
|
5
34
|
* Fixed release miss.
|
data/Rakefile
CHANGED
@@ -87,10 +87,10 @@ end
|
|
87
87
|
ENV["VERSION"] ||= guess_version
|
88
88
|
version = ENV["VERSION"]
|
89
89
|
project = nil
|
90
|
-
Hoe.spec('rroonga') do
|
90
|
+
Hoe.spec('rroonga') do
|
91
91
|
Hoe::Test::SUPPORTED_TEST_FRAMEWORKS[:testunit2] = "test/run-test.rb"
|
92
|
-
project =
|
93
|
-
project.version = version
|
92
|
+
project = self
|
93
|
+
project.version = version.dup
|
94
94
|
project.rubyforge_name = 'groonga'
|
95
95
|
authors = File.join(base_dir, "AUTHORS")
|
96
96
|
project.author = File.readlines(authors).collect do |line|
|
@@ -187,6 +187,7 @@ task :prepare_docs_for_publishing do
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
+
desc "Publish HTML to Web site."
|
190
191
|
task :publish_html do
|
191
192
|
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
192
193
|
host = "#{config["username"]}@rubyforge.org"
|
@@ -196,10 +197,9 @@ task :publish_html do
|
|
196
197
|
sh "rsync #{rsync_args} html/ #{host}:#{remote_dir}"
|
197
198
|
end
|
198
199
|
|
200
|
+
desc "Tag the current revision."
|
199
201
|
task :tag do
|
200
|
-
|
201
|
-
sh("svn cp -m 'release #{version}!!!' " +
|
202
|
-
"#{repository}/trunk #{repository}/tags/#{version}")
|
202
|
+
sh("git tag -a #{version} -m 'release #{version}!!!'")
|
203
203
|
end
|
204
204
|
|
205
205
|
# fix Hoe's incorrect guess.
|
data/ext/groonga/rb-grn-array.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C)
|
3
|
+
Copyright (C) 2010 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
|
@@ -107,19 +107,23 @@ rb_grn_context_to_exception (grn_ctx *context, VALUE related_object)
|
|
107
107
|
|
108
108
|
GRN_OBJ_INIT(&bulk, GRN_BULK, 0, GRN_ID_NIL);
|
109
109
|
GRN_TEXT_PUTS(context, &bulk, message);
|
110
|
-
|
111
|
-
|
110
|
+
if (context->errbuf[0]) {
|
111
|
+
GRN_TEXT_PUTS(context, &bulk, ": ");
|
112
|
+
GRN_TEXT_PUTS(context, &bulk, context->errbuf);
|
113
|
+
}
|
112
114
|
if (!NIL_P(related_object)) {
|
113
115
|
GRN_TEXT_PUTS(context, &bulk, ": ");
|
114
116
|
GRN_TEXT_PUTS(context, &bulk, rb_grn_inspect(related_object));
|
115
117
|
}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
118
|
+
if (context->errline > 0) {
|
119
|
+
GRN_TEXT_PUTS(context, &bulk, "\n");
|
120
|
+
GRN_TEXT_PUTS(context, &bulk, context->errfile);
|
121
|
+
GRN_TEXT_PUTS(context, &bulk, ":");
|
122
|
+
grn_text_itoa(context, &bulk, context->errline);
|
123
|
+
GRN_TEXT_PUTS(context, &bulk, ": ");
|
124
|
+
GRN_TEXT_PUTS(context, &bulk, context->errfunc);
|
125
|
+
GRN_TEXT_PUTS(context, &bulk, "()");
|
126
|
+
}
|
123
127
|
exception = rb_funcall(exception_class, rb_intern("new"), 1,
|
124
128
|
rb_str_new(GRN_BULK_HEAD(&bulk),
|
125
129
|
GRN_BULK_VSIZE(&bulk)));
|
@@ -410,7 +414,7 @@ static VALUE
|
|
410
414
|
rb_grn_context_connect (int argc, VALUE *argv, VALUE self)
|
411
415
|
{
|
412
416
|
grn_ctx *context;
|
413
|
-
char *host;
|
417
|
+
const char *host;
|
414
418
|
int port;
|
415
419
|
int flags = 0;
|
416
420
|
grn_rc rc;
|
@@ -610,21 +614,6 @@ rb_grn_context_array_reference (VALUE self, VALUE name_or_id)
|
|
610
614
|
return GRNOBJECT2RVAL(Qnil, context, object, RB_GRN_FALSE);
|
611
615
|
}
|
612
616
|
|
613
|
-
/*
|
614
|
-
* call-seq:
|
615
|
-
* context.pop -> 値
|
616
|
-
*
|
617
|
-
* コンテキスト内にあるスタックから値を取り出す。このスタッ
|
618
|
-
* クにはGroonga::Expression#executeの実行結果が格納される。
|
619
|
-
*/
|
620
|
-
static VALUE
|
621
|
-
rb_grn_context_pop (VALUE self)
|
622
|
-
{
|
623
|
-
grn_ctx *context;
|
624
|
-
context = SELF(self);
|
625
|
-
return GRNOBJ2RVAL(Qnil, context, grn_ctx_pop(context), self);
|
626
|
-
}
|
627
|
-
|
628
617
|
void
|
629
618
|
rb_grn_init_context (VALUE mGrn)
|
630
619
|
{
|
@@ -654,8 +643,6 @@ rb_grn_init_context (VALUE mGrn)
|
|
654
643
|
|
655
644
|
rb_define_method(cGrnContext, "[]", rb_grn_context_array_reference, 1);
|
656
645
|
|
657
|
-
rb_define_method(cGrnContext, "pop", rb_grn_context_pop, 0);
|
658
|
-
|
659
646
|
rb_define_method(cGrnContext, "connect", rb_grn_context_connect, -1);
|
660
647
|
rb_define_method(cGrnContext, "send", rb_grn_context_send, 1);
|
661
648
|
rb_define_method(cGrnContext, "receive", rb_grn_context_receive, 0);
|
@@ -89,6 +89,9 @@ static VALUE eGrnSyntaxError;
|
|
89
89
|
static VALUE eGrnRetryMax;
|
90
90
|
static VALUE eGrnIncompatibleFileFormat;
|
91
91
|
static VALUE eGrnUpdateNotAllowed;
|
92
|
+
static VALUE eGrnTooSmallOffset;
|
93
|
+
static VALUE eGrnTooLargeOffset;
|
94
|
+
static VALUE eGrnTooSmallLimit;
|
92
95
|
|
93
96
|
VALUE
|
94
97
|
rb_grn_rc_to_exception (grn_rc rc)
|
@@ -300,6 +303,15 @@ rb_grn_rc_to_exception (grn_rc rc)
|
|
300
303
|
case GRN_UPDATE_NOT_ALLOWED:
|
301
304
|
exception = eGrnUpdateNotAllowed;
|
302
305
|
break;
|
306
|
+
case GRN_TOO_SMALL_OFFSET:
|
307
|
+
exception = eGrnTooSmallOffset;
|
308
|
+
break;
|
309
|
+
case GRN_TOO_LARGE_OFFSET:
|
310
|
+
exception = eGrnTooLargeOffset;
|
311
|
+
break;
|
312
|
+
case GRN_TOO_SMALL_LIMIT:
|
313
|
+
exception = eGrnTooSmallLimit;
|
314
|
+
break;
|
303
315
|
}
|
304
316
|
|
305
317
|
if (NIL_P(exception))
|
@@ -518,6 +530,15 @@ rb_grn_rc_to_message (grn_rc rc)
|
|
518
530
|
case GRN_UPDATE_NOT_ALLOWED:
|
519
531
|
message = "update isn't allowed";
|
520
532
|
break;
|
533
|
+
case GRN_TOO_SMALL_OFFSET:
|
534
|
+
message = "too small offset";
|
535
|
+
break;
|
536
|
+
case GRN_TOO_LARGE_OFFSET:
|
537
|
+
message = "too large offset";
|
538
|
+
break;
|
539
|
+
case GRN_TOO_SMALL_LIMIT:
|
540
|
+
message = "too small limit";
|
541
|
+
break;
|
521
542
|
}
|
522
543
|
|
523
544
|
if (!message)
|
@@ -549,7 +570,7 @@ rb_grn_init_exception (VALUE mGrn)
|
|
549
570
|
/*
|
550
571
|
* Document-class: Groonga::Error
|
551
572
|
*
|
552
|
-
*
|
573
|
+
* rroongaが発生する例外のスーパークラス。
|
553
574
|
*/
|
554
575
|
rb_eGrnError =
|
555
576
|
rb_define_class_under(mGrn, "Error", rb_eStandardError);
|
@@ -1107,4 +1128,28 @@ rb_grn_init_exception (VALUE mGrn)
|
|
1107
1128
|
*/
|
1108
1129
|
eGrnUpdateNotAllowed =
|
1109
1130
|
rb_define_class_under(mGrn, "UpdateNotAllowed", rb_eGrnError);
|
1131
|
+
|
1132
|
+
/*
|
1133
|
+
* Document-class: Groonga::TooSmallOffset
|
1134
|
+
*
|
1135
|
+
* offset値が小さすぎるときに発生する。
|
1136
|
+
*/
|
1137
|
+
eGrnTooSmallOffset =
|
1138
|
+
rb_define_class_under(mGrn, "TooSmallOffset", rb_eGrnError);
|
1139
|
+
|
1140
|
+
/*
|
1141
|
+
* Document-class: Groonga::TooLargeOffset
|
1142
|
+
*
|
1143
|
+
* offset値が大きすぎるときに発生する。
|
1144
|
+
*/
|
1145
|
+
eGrnTooLargeOffset =
|
1146
|
+
rb_define_class_under(mGrn, "TooLargeOffset", rb_eGrnError);
|
1147
|
+
|
1148
|
+
/*
|
1149
|
+
* Document-class: Groonga::TooSmallLimit
|
1150
|
+
*
|
1151
|
+
* limit値が小さすぎるときに発生する。
|
1152
|
+
*/
|
1153
|
+
eGrnTooSmallLimit =
|
1154
|
+
rb_define_class_under(mGrn, "TooSmallLimit", rb_eGrnError);
|
1110
1155
|
}
|
@@ -333,7 +333,8 @@ static VALUE
|
|
333
333
|
rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
334
334
|
{
|
335
335
|
grn_ctx *context = NULL;
|
336
|
-
grn_obj *expression, *default_column
|
336
|
+
grn_obj *expression, *default_column;
|
337
|
+
rb_grn_boolean default_column_is_created = RB_GRN_FALSE;
|
337
338
|
grn_operator default_operator = GRN_OP_AND;
|
338
339
|
grn_operator default_mode = GRN_OP_MATCH;
|
339
340
|
grn_rc rc;
|
@@ -363,7 +364,15 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
363
364
|
NULL, NULL,
|
364
365
|
NULL, NULL, NULL);
|
365
366
|
|
366
|
-
|
367
|
+
if (NIL_P(rb_default_column)) {
|
368
|
+
default_column = NULL;
|
369
|
+
} else if (RVAL2CBOOL(rb_obj_is_kind_of(rb_default_column, rb_cGrnObject))) {
|
370
|
+
default_column = RVAL2GRNOBJECT(rb_default_column, &context);
|
371
|
+
} else {
|
372
|
+
default_column = RVAL2GRNBULK(rb_default_column, context, NULL);
|
373
|
+
default_column_is_created = RB_GRN_TRUE;
|
374
|
+
}
|
375
|
+
|
367
376
|
if (!NIL_P(rb_default_mode))
|
368
377
|
default_mode = RVAL2GRNOPERATOR(rb_default_mode);
|
369
378
|
if (!NIL_P(rb_default_operator))
|
@@ -382,10 +391,10 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
382
391
|
}
|
383
392
|
|
384
393
|
if (NIL_P(rb_allow_pragma)) {
|
385
|
-
if ((flags &
|
394
|
+
if (!(flags & GRN_EXPR_SYNTAX_SCRIPT))
|
386
395
|
flags |= GRN_EXPR_ALLOW_PRAGMA;
|
387
396
|
} else {
|
388
|
-
if ((flags & GRN_EXPR_SYNTAX_SCRIPT)
|
397
|
+
if ((flags & GRN_EXPR_SYNTAX_SCRIPT))
|
389
398
|
rb_raise(rb_eArgError,
|
390
399
|
":allow_pragma isn't allowed in script syntax");
|
391
400
|
if (RVAL2CBOOL(rb_allow_pragma))
|
@@ -393,10 +402,10 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
393
402
|
}
|
394
403
|
|
395
404
|
if (NIL_P(rb_allow_column)) {
|
396
|
-
if ((flags &
|
405
|
+
if (!(flags & GRN_EXPR_SYNTAX_SCRIPT))
|
397
406
|
flags |= GRN_EXPR_ALLOW_COLUMN;
|
398
407
|
} else {
|
399
|
-
if ((flags & GRN_EXPR_SYNTAX_SCRIPT)
|
408
|
+
if ((flags & GRN_EXPR_SYNTAX_SCRIPT))
|
400
409
|
rb_raise(rb_eArgError,
|
401
410
|
":allow_column isn't allowed in script syntax");
|
402
411
|
if (RVAL2CBOOL(rb_allow_column))
|
@@ -419,7 +428,8 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
419
428
|
related_object = rb_ary_new3(2, self, rb_ary_new4(argc, argv));
|
420
429
|
exception = rb_grn_context_to_exception(context, related_object);
|
421
430
|
}
|
422
|
-
|
431
|
+
if (default_column_is_created)
|
432
|
+
grn_obj_unlink(context, default_column);
|
423
433
|
|
424
434
|
if (!NIL_P(exception))
|
425
435
|
rb_exc_raise(exception);
|
@@ -429,26 +439,25 @@ rb_grn_expression_parse (int argc, VALUE *argv, VALUE self)
|
|
429
439
|
|
430
440
|
/*
|
431
441
|
* call-seq:
|
432
|
-
* expression.execute
|
442
|
+
* expression.execute -> 値
|
433
443
|
*
|
434
|
-
* _expression_
|
444
|
+
* _expression_を実行し、実行した結果を返す。
|
435
445
|
*/
|
436
446
|
static VALUE
|
437
447
|
rb_grn_expression_execute (VALUE self)
|
438
448
|
{
|
439
449
|
grn_ctx *context = NULL;
|
440
450
|
grn_obj *expression;
|
441
|
-
|
451
|
+
grn_obj *result;
|
442
452
|
|
443
453
|
rb_grn_expression_deconstruct(SELF(self), &expression, &context,
|
444
454
|
NULL, NULL,
|
445
455
|
NULL, NULL, NULL);
|
446
456
|
|
447
|
-
|
457
|
+
result = grn_expr_exec(context, expression, 0);
|
448
458
|
rb_grn_context_check(context, self);
|
449
|
-
rb_grn_rc_check(rc, self);
|
450
459
|
|
451
|
-
return Qnil;
|
460
|
+
return GRNOBJ2RVAL(Qnil, context, result, self);
|
452
461
|
}
|
453
462
|
|
454
463
|
/*
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
Copyright (C) 2009-2010 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
|
@@ -77,13 +77,7 @@ rb_grn_fix_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
|
|
77
77
|
&value, &range_id, &range);
|
78
78
|
|
79
79
|
id = NUM2UINT(rb_id);
|
80
|
-
|
81
|
-
if ((value->header.domain == GRN_DB_INT32 ||
|
82
|
-
value->header.domain == GRN_DB_UINT32) &&
|
83
|
-
(GRN_TABLE_HASH_KEY <= range->header.type &&
|
84
|
-
range->header.type <= GRN_TABLE_VIEW)) {
|
85
|
-
value->header.domain = range_id;
|
86
|
-
}
|
80
|
+
RVAL2GRNBULK_WITH_TYPE(rb_value, context, value, range_id, range);
|
87
81
|
|
88
82
|
rc = grn_obj_set_value(context, column, id, value, GRN_OBJ_SET);
|
89
83
|
rb_grn_context_check(context, self);
|
data/ext/groonga/rb-grn-hash.c
CHANGED
@@ -62,6 +62,9 @@ VALUE rb_cGrnHash;
|
|
62
62
|
* Groonga::Contextに結びついているデータベースが一時デー
|
63
63
|
* タベースの場合は例外が発生する。
|
64
64
|
*
|
65
|
+
* [+:key_normalize+]
|
66
|
+
* +true+を指定するとキーを正規化する。
|
67
|
+
*
|
65
68
|
* [+:key_type+]
|
66
69
|
* キーの種類を示すオブジェクトを指定する。キーの種類には型
|
67
70
|
* 名("Int32"や"ShortText"など)またはGroonga::Typeまたは
|
@@ -152,7 +155,7 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
152
155
|
grn_obj_flags flags = GRN_TABLE_HASH_KEY;
|
153
156
|
VALUE rb_table;
|
154
157
|
VALUE options, rb_context, rb_name, rb_path, rb_persistent;
|
155
|
-
VALUE rb_key_type, rb_value_type, rb_default_tokenizer;
|
158
|
+
VALUE rb_key_normalize, rb_key_type, rb_value_type, rb_default_tokenizer;
|
156
159
|
VALUE rb_sub_records;
|
157
160
|
|
158
161
|
rb_scan_args(argc, argv, "01", &options);
|
@@ -162,6 +165,7 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
162
165
|
"name", &rb_name,
|
163
166
|
"path", &rb_path,
|
164
167
|
"persistent", &rb_persistent,
|
168
|
+
"key_normalize", &rb_key_normalize,
|
165
169
|
"key_type", &rb_key_type,
|
166
170
|
"value_type", &rb_value_type,
|
167
171
|
"default_tokenizer", &rb_default_tokenizer,
|
@@ -184,6 +188,9 @@ rb_grn_hash_s_create (int argc, VALUE *argv, VALUE klass)
|
|
184
188
|
if (RVAL2CBOOL(rb_persistent))
|
185
189
|
flags |= GRN_OBJ_PERSISTENT;
|
186
190
|
|
191
|
+
if (RVAL2CBOOL(rb_key_normalize))
|
192
|
+
flags |= GRN_OBJ_KEY_NORMALIZE;
|
193
|
+
|
187
194
|
if (NIL_P(rb_key_type)) {
|
188
195
|
flags |= GRN_OBJ_KEY_VAR_SIZE;
|
189
196
|
} else {
|
data/ext/groonga/rb-grn-object.c
CHANGED
@@ -429,7 +429,7 @@ rb_grn_named_object_set_name (RbGrnNamedObject *rb_grn_named_object,
|
|
429
429
|
const char *name, unsigned name_size)
|
430
430
|
{
|
431
431
|
if (rb_grn_named_object->name) {
|
432
|
-
|
432
|
+
xfree(rb_grn_named_object->name);
|
433
433
|
rb_grn_named_object->name = NULL;
|
434
434
|
}
|
435
435
|
if (name_size > 0) {
|
@@ -396,7 +396,7 @@ rb_grn_patricia_trie_scan (VALUE self, VALUE rb_string)
|
|
396
396
|
while (string_length > 0) {
|
397
397
|
const char *rest;
|
398
398
|
int i, n_hits;
|
399
|
-
|
399
|
+
unsigned int previous_offset = 0;
|
400
400
|
|
401
401
|
n_hits = grn_pat_scan(context, (grn_pat *)table,
|
402
402
|
string, string_length,
|
@@ -469,6 +469,25 @@ rb_grn_patricia_trie_prefix_search (VALUE self, VALUE rb_prefix)
|
|
469
469
|
return rb_result;
|
470
470
|
}
|
471
471
|
|
472
|
+
/*
|
473
|
+
* call-seq:
|
474
|
+
* table.register_key_with_sis? -> true/false
|
475
|
+
*
|
476
|
+
* キーを登録するときに文字列の全suffixも一緒に登録する場合
|
477
|
+
* は+true+、登録しない場合は+false+を返す。
|
478
|
+
*/
|
479
|
+
static VALUE
|
480
|
+
rb_grn_patricia_trie_register_key_with_sis_p (VALUE self)
|
481
|
+
{
|
482
|
+
grn_obj *table;
|
483
|
+
|
484
|
+
rb_grn_table_key_support_deconstruct(SELF(self), &table, NULL,
|
485
|
+
NULL, NULL, NULL,
|
486
|
+
NULL, NULL, NULL,
|
487
|
+
NULL);
|
488
|
+
return CBOOL2RVAL(table->header.flags & GRN_OBJ_KEY_WITH_SIS);
|
489
|
+
}
|
490
|
+
|
472
491
|
void
|
473
492
|
rb_grn_init_patricia_trie (VALUE mGrn)
|
474
493
|
{
|
@@ -485,4 +504,7 @@ rb_grn_init_patricia_trie (VALUE mGrn)
|
|
485
504
|
rb_grn_patricia_trie_scan, 1);
|
486
505
|
rb_define_method(rb_cGrnPatriciaTrie, "prefix_search",
|
487
506
|
rb_grn_patricia_trie_prefix_search, 1);
|
507
|
+
|
508
|
+
rb_define_method(rb_cGrnPatriciaTrie, "register_key_with_sis?",
|
509
|
+
rb_grn_patricia_trie_register_key_with_sis_p, 0);
|
488
510
|
}
|