rroonga 1.2.0 → 1.2.1
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/README.textile +71 -0
- data/Rakefile +213 -128
- data/TODO +0 -0
- data/example/bookmark.rb +12 -12
- data/ext/groonga/Makefile +233 -0
- data/ext/groonga/extconf.rb +1 -1
- data/ext/groonga/rb-grn-column.c +5 -5
- data/ext/groonga/rb-grn-index-column.c +31 -0
- data/ext/groonga/rb-grn-index-cursor.c +106 -0
- data/ext/groonga/rb-grn-logger.c +5 -5
- data/ext/groonga/rb-grn-object.c +48 -0
- data/ext/groonga/rb-grn-patricia-trie.c +1 -1
- data/ext/groonga/rb-grn-plugin.c +32 -0
- data/ext/groonga/rb-grn-posting.c +51 -0
- data/ext/groonga/rb-grn-table-cursor.c +6 -1
- data/ext/groonga/rb-grn-table.c +31 -13
- data/ext/groonga/rb-grn.h +21 -3
- data/ext/groonga/rb-groonga.c +3 -1
- data/lib/groonga.rb +1 -0
- data/lib/groonga/dumper.rb +25 -5
- data/lib/groonga/expression-builder.rb +2 -2
- data/lib/groonga/pagination.rb +99 -7
- data/lib/groonga/posting.rb +87 -0
- data/lib/groonga/record.rb +118 -11
- data/lib/groonga/schema.rb +18 -1
- data/test/groonga-test-utils.rb +1 -6
- data/test/run-test.rb +13 -28
- data/test/test-column.rb +4 -0
- data/test/test-database-dumper.rb +53 -10
- data/test/test-hash.rb +6 -6
- data/test/test-index-cursor.rb +93 -0
- data/test/test-plugin.rb +6 -0
- data/test/test-record.rb +162 -1
- data/test/test-schema-type.rb +6 -0
- data/test/test-schema.rb +17 -0
- data/test/test-table.rb +7 -2
- data/test/test-type.rb +9 -1
- metadata +135 -245
- data/AUTHORS +0 -5
- data/NEWS.ja.rdoc +0 -344
- data/NEWS.rdoc +0 -346
- data/README.ja.rdoc +0 -68
- data/README.rdoc +0 -68
- data/example/search/config.ru +0 -230
- data/example/search/public/css/groonga.css +0 -122
- data/ext/.gitignore +0 -2
- data/html/bar.svg +0 -153
- data/html/developer.html +0 -151
- data/html/developer.svg +0 -469
- data/html/download.svg +0 -253
- data/html/favicon.ico +0 -0
- data/html/favicon.svg +0 -591
- data/html/footer.html.erb +0 -33
- data/html/head.html.erb +0 -4
- data/html/header.html.erb +0 -17
- data/html/heading-mark.svg +0 -393
- data/html/index.html +0 -243
- data/html/install.svg +0 -636
- data/html/logo.svg +0 -612
- data/html/ranguba.css +0 -342
- data/html/readme.svg +0 -256
- data/html/tutorial.svg +0 -559
- data/license/LGPL +0 -504
- data/test-unit-notify/Rakefile +0 -47
- data/test-unit-notify/lib/test/unit/notify.rb +0 -104
- data/test-unit/COPYING +0 -56
- data/test-unit/GPL +0 -340
- data/test-unit/PSFL +0 -271
- data/test-unit/Rakefile +0 -53
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/html/bar.svg +0 -153
- data/test-unit/html/developer.svg +0 -469
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.svg +0 -82
- data/test-unit/html/heading-mark.svg +0 -393
- data/test-unit/html/index.html +0 -247
- data/test-unit/html/index.html.ja +0 -270
- data/test-unit/html/install.svg +0 -636
- data/test-unit/html/logo.svg +0 -483
- data/test-unit/html/test-unit.css +0 -339
- data/test-unit/html/tutorial.svg +0 -559
- data/test-unit/lib/test/unit.rb +0 -328
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
- data/test-unit/lib/test/unit/assertions.rb +0 -1334
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -363
- data/test-unit/lib/test/unit/collector.rb +0 -36
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -144
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -106
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -740
- data/test-unit/lib/test/unit/error.rb +0 -130
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -136
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -129
- data/test-unit/lib/test/unit/omission.rb +0 -191
- data/test-unit/lib/test/unit/pending.rb +0 -150
- data/test-unit/lib/test/unit/priority.rb +0 -180
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -483
- data/test-unit/lib/test/unit/testresult.rb +0 -121
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -430
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -82
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -53
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -42
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/output.rb +0 -31
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/test_adder.rb +0 -20
- data/test-unit/sample/test_subtracter.rb +0 -20
- data/test-unit/sample/test_user.rb +0 -23
- data/test-unit/test/collector/test-descendant.rb +0 -133
- data/test-unit/test/collector/test-load.rb +0 -442
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -100
- data/test-unit/test/run-test.rb +0 -15
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -69
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -518
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -544
- data/test-unit/test/test_assertions.rb +0 -1197
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_tap.rb +0 -33
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test-output.rb +0 -11
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
- data/test/.gitignore +0 -1
- data/text/expression.rdoc +0 -285
- data/text/tutorial.ja.rdoc +0 -433
data/ext/groonga/rb-grn-logger.c
CHANGED
|
@@ -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
|
|
@@ -392,7 +392,7 @@ rb_grn_logger_s_set_path (VALUE klass, VALUE rb_path,
|
|
|
392
392
|
|
|
393
393
|
/*
|
|
394
394
|
* call-seq:
|
|
395
|
-
* Groonga::Logger.log_path # =>
|
|
395
|
+
* Groonga::Logger.log_path # => path
|
|
396
396
|
*
|
|
397
397
|
* groongaのデフォルトロガーがログを出力するファイルの
|
|
398
398
|
* パスを返す。
|
|
@@ -414,7 +414,7 @@ rb_grn_logger_s_get_log_path (VALUE klass)
|
|
|
414
414
|
|
|
415
415
|
/*
|
|
416
416
|
* call-seq:
|
|
417
|
-
* Groonga::Logger.log_path
|
|
417
|
+
* Groonga::Logger.log_path= path
|
|
418
418
|
*
|
|
419
419
|
* groongaのデフォルトロガーがログを出力するファイルのパスを
|
|
420
420
|
* 指定する。
|
|
@@ -435,7 +435,7 @@ rb_grn_logger_s_set_log_path (VALUE klass, VALUE path)
|
|
|
435
435
|
|
|
436
436
|
/*
|
|
437
437
|
* call-seq:
|
|
438
|
-
* Groonga::Logger.query_log_path # =>
|
|
438
|
+
* Groonga::Logger.query_log_path # => path
|
|
439
439
|
*
|
|
440
440
|
* groongaのデフォルトロガーがクエリログを出力するファイルの
|
|
441
441
|
* パスを返す。
|
|
@@ -457,7 +457,7 @@ rb_grn_logger_s_get_query_log_path (VALUE klass)
|
|
|
457
457
|
|
|
458
458
|
/*
|
|
459
459
|
* call-seq:
|
|
460
|
-
* Groonga::Logger.query_log_path
|
|
460
|
+
* Groonga::Logger.query_log_path= path
|
|
461
461
|
*
|
|
462
462
|
* groongaのデフォルトロガーがクエリログを出力するファイルの
|
|
463
463
|
* パスを指定する。
|
data/ext/groonga/rb-grn-object.c
CHANGED
|
@@ -123,6 +123,8 @@ rb_grn_object_finalizer (grn_ctx *context, int n_args, grn_obj **grn_objects,
|
|
|
123
123
|
rb_grn_table_finalizer(context, grn_object,
|
|
124
124
|
RB_GRN_TABLE(rb_grn_object));
|
|
125
125
|
break;
|
|
126
|
+
case GRN_CURSOR_COLUMN_INDEX:
|
|
127
|
+
break;
|
|
126
128
|
case GRN_COLUMN_FIX_SIZE:
|
|
127
129
|
case GRN_COLUMN_VAR_SIZE:
|
|
128
130
|
rb_grn_column_finalizer(context, grn_object,
|
|
@@ -351,6 +353,7 @@ rb_grn_object_assign (VALUE klass, VALUE self, VALUE rb_context,
|
|
|
351
353
|
klass == rb_cGrnPatriciaTrieCursor ||
|
|
352
354
|
klass == rb_cGrnArrayCursor ||
|
|
353
355
|
klass == rb_cGrnViewCursor ||
|
|
356
|
+
klass == rb_cGrnIndexCursor ||
|
|
354
357
|
klass == rb_cGrnProcedure ||
|
|
355
358
|
klass == rb_cGrnVariable) {
|
|
356
359
|
rb_grn_object = ALLOC(RbGrnObject);
|
|
@@ -499,10 +502,33 @@ rb_grn_object_close (VALUE self)
|
|
|
499
502
|
grn_obj *object;
|
|
500
503
|
grn_ctx *context;
|
|
501
504
|
|
|
505
|
+
rb_grn_object_deconstruct(SELF(self), &object, &context,
|
|
506
|
+
NULL, NULL, NULL, NULL);
|
|
507
|
+
if (object && context)
|
|
508
|
+
grn_obj_close(context, object);
|
|
509
|
+
|
|
510
|
+
return Qnil;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/*
|
|
514
|
+
* Document-method: unlink
|
|
515
|
+
*
|
|
516
|
+
* call-seq:
|
|
517
|
+
* object.unlink
|
|
518
|
+
*
|
|
519
|
+
* _object_のリファレンスカウンタを1減少する。
|
|
520
|
+
*/
|
|
521
|
+
VALUE
|
|
522
|
+
rb_grn_object_unlink (VALUE self)
|
|
523
|
+
{
|
|
524
|
+
grn_obj *object;
|
|
525
|
+
grn_ctx *context;
|
|
526
|
+
|
|
502
527
|
rb_grn_object_deconstruct(SELF(self), &object, &context,
|
|
503
528
|
NULL, NULL, NULL, NULL);
|
|
504
529
|
if (object && context)
|
|
505
530
|
grn_obj_unlink(context, object);
|
|
531
|
+
|
|
506
532
|
return Qnil;
|
|
507
533
|
}
|
|
508
534
|
|
|
@@ -1343,6 +1369,23 @@ rb_grn_object_remove (VALUE self)
|
|
|
1343
1369
|
return Qnil;
|
|
1344
1370
|
}
|
|
1345
1371
|
|
|
1372
|
+
static VALUE
|
|
1373
|
+
rb_grn_object_builtin_p (VALUE self)
|
|
1374
|
+
{
|
|
1375
|
+
grn_ctx *context;
|
|
1376
|
+
grn_obj *object;
|
|
1377
|
+
grn_bool builtin = GRN_FALSE;
|
|
1378
|
+
|
|
1379
|
+
rb_grn_object_deconstruct(SELF(self), &object, &context,
|
|
1380
|
+
NULL, NULL, NULL, NULL);
|
|
1381
|
+
|
|
1382
|
+
if (context && object) {
|
|
1383
|
+
builtin = grn_obj_is_builtin(context, object);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
return CBOOL2RVAL(builtin);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1346
1389
|
void
|
|
1347
1390
|
rb_grn_init_object (VALUE mGrn)
|
|
1348
1391
|
{
|
|
@@ -1368,10 +1411,15 @@ rb_grn_init_object (VALUE mGrn)
|
|
|
1368
1411
|
rb_define_method(rb_cGrnObject, "close", rb_grn_object_close, 0);
|
|
1369
1412
|
rb_define_method(rb_cGrnObject, "closed?", rb_grn_object_closed_p, 0);
|
|
1370
1413
|
|
|
1414
|
+
rb_define_method(rb_cGrnObject, "unlink", rb_grn_object_unlink, 0);
|
|
1415
|
+
|
|
1371
1416
|
rb_define_method(rb_cGrnObject, "[]", rb_grn_object_array_reference, 1);
|
|
1372
1417
|
rb_define_method(rb_cGrnObject, "[]=", rb_grn_object_array_set, 2);
|
|
1373
1418
|
rb_define_method(rb_cGrnObject, "append", rb_grn_object_append_value, 2);
|
|
1374
1419
|
rb_define_method(rb_cGrnObject, "prepend", rb_grn_object_prepend_value, 2);
|
|
1375
1420
|
|
|
1376
1421
|
rb_define_method(rb_cGrnObject, "remove", rb_grn_object_remove, 0);
|
|
1422
|
+
|
|
1423
|
+
rb_define_method(rb_cGrnObject, "builtin?", rb_grn_object_builtin_p, 0);
|
|
1424
|
+
|
|
1377
1425
|
}
|
data/ext/groonga/rb-grn-plugin.c
CHANGED
|
@@ -123,6 +123,34 @@ rb_grn_plugin_s_register (int argc, VALUE *argv, VALUE klass)
|
|
|
123
123
|
return Qnil;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* call-seq:
|
|
128
|
+
* Groonga::Plugin.system_plugins_dir
|
|
129
|
+
*
|
|
130
|
+
* Returns the system plugins directory.
|
|
131
|
+
*
|
|
132
|
+
* @return The system plugins directory.
|
|
133
|
+
*/
|
|
134
|
+
static VALUE
|
|
135
|
+
rb_grn_plugin_s_system_plugins_dir (VALUE klass)
|
|
136
|
+
{
|
|
137
|
+
return rb_str_new2(grn_plugin_get_system_plugins_dir());
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* call-seq:
|
|
142
|
+
* Groonga::Plugin.suffix
|
|
143
|
+
*
|
|
144
|
+
* Returns the plugin file suffix. (e.g. ".so", ".dll" and so on.)
|
|
145
|
+
*
|
|
146
|
+
* @return The plugin file suffix.
|
|
147
|
+
*/
|
|
148
|
+
static VALUE
|
|
149
|
+
rb_grn_plugin_s_suffix (VALUE klass)
|
|
150
|
+
{
|
|
151
|
+
return rb_str_new2(grn_plugin_get_suffix());
|
|
152
|
+
}
|
|
153
|
+
|
|
126
154
|
void
|
|
127
155
|
rb_grn_init_plugin (VALUE mGrn)
|
|
128
156
|
{
|
|
@@ -131,4 +159,8 @@ rb_grn_init_plugin (VALUE mGrn)
|
|
|
131
159
|
|
|
132
160
|
rb_define_singleton_method(cGrnPlugin, "register",
|
|
133
161
|
rb_grn_plugin_s_register, -1);
|
|
162
|
+
rb_define_singleton_method(cGrnPlugin, "system_plugins_dir",
|
|
163
|
+
rb_grn_plugin_s_system_plugins_dir, 0);
|
|
164
|
+
rb_define_singleton_method(cGrnPlugin, "suffix",
|
|
165
|
+
rb_grn_plugin_s_suffix, 0);
|
|
134
166
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2011 Haruka Yoshihara <yoshihara@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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#include "rb-grn.h"
|
|
20
|
+
|
|
21
|
+
VALUE rb_cGrnPosting;
|
|
22
|
+
|
|
23
|
+
VALUE
|
|
24
|
+
rb_grn_posting_new (grn_posting *posting, grn_id term_id)
|
|
25
|
+
{
|
|
26
|
+
VALUE parameters;
|
|
27
|
+
|
|
28
|
+
parameters = rb_hash_new();
|
|
29
|
+
|
|
30
|
+
#define SET_PARAMETER(key, value) \
|
|
31
|
+
rb_hash_aset(parameters, ID2SYM(rb_intern((key))), INT2NUM((value)))
|
|
32
|
+
|
|
33
|
+
SET_PARAMETER("record_id", posting->rid);
|
|
34
|
+
SET_PARAMETER("section_id", posting->sid);
|
|
35
|
+
SET_PARAMETER("term_id", term_id);
|
|
36
|
+
SET_PARAMETER("position", posting->pos);
|
|
37
|
+
SET_PARAMETER("term_frequency", posting->tf);
|
|
38
|
+
SET_PARAMETER("weight", posting->weight);
|
|
39
|
+
SET_PARAMETER("n_rest_postings", posting->rest);
|
|
40
|
+
|
|
41
|
+
#undef SET_PARAMETER
|
|
42
|
+
|
|
43
|
+
return rb_funcall(rb_cGrnPosting, rb_intern("new"), 1,
|
|
44
|
+
parameters);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void
|
|
48
|
+
rb_grn_init_posting (VALUE mGrn)
|
|
49
|
+
{
|
|
50
|
+
rb_cGrnPosting = rb_const_get(mGrn, rb_intern("Posting"));
|
|
51
|
+
}
|
|
@@ -32,11 +32,16 @@ VALUE rb_cGrnTableCursor;
|
|
|
32
32
|
grn_table_cursor *
|
|
33
33
|
rb_grn_table_cursor_from_ruby_object (VALUE object, grn_ctx **context)
|
|
34
34
|
{
|
|
35
|
+
grn_table_cursor *table_cursor;
|
|
36
|
+
|
|
35
37
|
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnTableCursor))) {
|
|
36
38
|
rb_raise(rb_eTypeError, "not a groonga table cursor");
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
rb_grn_table_cursor_deconstruct(SELF(object), &table_cursor, NULL,
|
|
42
|
+
NULL, NULL,
|
|
43
|
+
NULL, NULL);
|
|
44
|
+
return table_cursor;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
VALUE
|
data/ext/groonga/rb-grn-table.c
CHANGED
|
@@ -34,7 +34,7 @@ static ID id_array_set;
|
|
|
34
34
|
/*
|
|
35
35
|
* Document-class: Groonga::Table < Groonga::Object
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* rroongaが提供するテーブルのベースとなるクラス。このクラス
|
|
38
38
|
* からGroonga::Array, Groonga::Hash, Groonga::PatriciaTrie
|
|
39
39
|
* が継承されている。
|
|
40
40
|
*/
|
|
@@ -982,13 +982,32 @@ rb_grn_table_delete (VALUE self, VALUE rb_id)
|
|
|
982
982
|
* テーブルに登録されているレコードを_keys_で指定されたルー
|
|
983
983
|
* ルに従ってソートしたレコードの配列を返す。
|
|
984
984
|
*
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
*
|
|
991
|
-
*
|
|
985
|
+
* _order_には+:asc+, +:ascending+, +:desc+, +:descending+の
|
|
986
|
+
* いずれを指定する。
|
|
987
|
+
*
|
|
988
|
+
* [ハッシュの配列で指定する方法]
|
|
989
|
+
* オーソドックスな指定方法。
|
|
990
|
+
*
|
|
991
|
+
* [
|
|
992
|
+
* {:key => "第1ソートキー", :order => order},
|
|
993
|
+
* {:key => "第2ソートキー", :order => order},
|
|
994
|
+
* ...,
|
|
995
|
+
* ]
|
|
996
|
+
*
|
|
997
|
+
* [配列の配列で指定する方法]
|
|
998
|
+
* 少し簡単化した指定方法。
|
|
999
|
+
*
|
|
1000
|
+
* [
|
|
1001
|
+
* ["第1ソートキー", order],
|
|
1002
|
+
* ["第2ソートキー", order],
|
|
1003
|
+
* ...,
|
|
1004
|
+
* ]
|
|
1005
|
+
*
|
|
1006
|
+
* [ソートキーの配列で指定する方法]
|
|
1007
|
+
* _order_は常に昇順(+:ascending+)になるが、最も簡単
|
|
1008
|
+
* に指定できる。
|
|
1009
|
+
*
|
|
1010
|
+
* ["第1ソートキー", "第2ソートキー", ...]
|
|
992
1011
|
*
|
|
993
1012
|
* _options_に指定可能な値は以下の通り。
|
|
994
1013
|
*
|
|
@@ -1065,14 +1084,13 @@ rb_grn_table_sort (int argc, VALUE *argv, VALUE self)
|
|
|
1065
1084
|
"no such column: <%s>: <%s>",
|
|
1066
1085
|
rb_grn_inspect(rb_key), rb_grn_inspect(self));
|
|
1067
1086
|
}
|
|
1068
|
-
if (NIL_P(rb_order)
|
|
1069
|
-
|
|
1087
|
+
if (NIL_P(rb_order) ||
|
|
1088
|
+
rb_grn_equal_option(rb_order, "asc") ||
|
|
1089
|
+
rb_grn_equal_option(rb_order, "ascending")) {
|
|
1090
|
+
keys[i].flags = GRN_TABLE_SORT_ASC;
|
|
1070
1091
|
} else if (rb_grn_equal_option(rb_order, "desc") ||
|
|
1071
1092
|
rb_grn_equal_option(rb_order, "descending")) {
|
|
1072
1093
|
keys[i].flags = GRN_TABLE_SORT_DESC;
|
|
1073
|
-
} else if (rb_grn_equal_option(rb_order, "asc") ||
|
|
1074
|
-
rb_grn_equal_option(rb_order, "ascending")) {
|
|
1075
|
-
keys[i].flags = GRN_TABLE_SORT_ASC;
|
|
1076
1094
|
} else {
|
|
1077
1095
|
rb_raise(rb_eArgError,
|
|
1078
1096
|
"order should be one of "
|
data/ext/groonga/rb-grn.h
CHANGED
|
@@ -69,7 +69,7 @@ RB_GRN_BEGIN_DECLS
|
|
|
69
69
|
|
|
70
70
|
#define RB_GRN_MAJOR_VERSION 1
|
|
71
71
|
#define RB_GRN_MINOR_VERSION 2
|
|
72
|
-
#define RB_GRN_MICRO_VERSION
|
|
72
|
+
#define RB_GRN_MICRO_VERSION 1
|
|
73
73
|
|
|
74
74
|
#define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
|
|
75
75
|
|
|
@@ -149,6 +149,12 @@ struct _RbGrnIndexColumn
|
|
|
149
149
|
grn_obj *string_query;
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
typedef struct _RbGrnIndexCursor RbGrnIndexCursor;
|
|
153
|
+
struct _RbGrnIndexCursor
|
|
154
|
+
{
|
|
155
|
+
RbGrnObject parent;
|
|
156
|
+
};
|
|
157
|
+
|
|
152
158
|
typedef struct _RbGrnAccessor RbGrnAccessor;
|
|
153
159
|
struct _RbGrnAccessor
|
|
154
160
|
{
|
|
@@ -210,6 +216,7 @@ RB_GRN_VAR VALUE rb_cGrnColumn;
|
|
|
210
216
|
RB_GRN_VAR VALUE rb_cGrnFixSizeColumn;
|
|
211
217
|
RB_GRN_VAR VALUE rb_cGrnVariableSizeColumn;
|
|
212
218
|
RB_GRN_VAR VALUE rb_cGrnIndexColumn;
|
|
219
|
+
RB_GRN_VAR VALUE rb_cGrnIndexCursor;
|
|
213
220
|
RB_GRN_VAR VALUE rb_cGrnAccessor;
|
|
214
221
|
RB_GRN_VAR VALUE rb_cGrnViewAccessor;
|
|
215
222
|
RB_GRN_VAR VALUE rb_cGrnRecord;
|
|
@@ -249,6 +256,8 @@ void rb_grn_init_column (VALUE mGrn);
|
|
|
249
256
|
void rb_grn_init_fix_size_column (VALUE mGrn);
|
|
250
257
|
void rb_grn_init_variable_size_column (VALUE mGrn);
|
|
251
258
|
void rb_grn_init_index_column (VALUE mGrn);
|
|
259
|
+
void rb_grn_init_index_cursor (VALUE mGrn);
|
|
260
|
+
void rb_grn_init_posting (VALUE mGrn);
|
|
252
261
|
void rb_grn_init_accessor (VALUE mGrn);
|
|
253
262
|
void rb_grn_init_view_accessor (VALUE mGrn);
|
|
254
263
|
void rb_grn_init_record (VALUE mGrn);
|
|
@@ -282,7 +291,7 @@ grn_obj *rb_grn_context_get_backward_compatibility
|
|
|
282
291
|
const char *rb_grn_inspect (VALUE object);
|
|
283
292
|
void rb_grn_scan_options (VALUE options, ...)
|
|
284
293
|
RB_GRN_GNUC_NULL_TERMINATED;
|
|
285
|
-
grn_bool
|
|
294
|
+
grn_bool rb_grn_equal_option (VALUE option,
|
|
286
295
|
const char *key);
|
|
287
296
|
|
|
288
297
|
VALUE rb_grn_object_alloc (VALUE klass);
|
|
@@ -458,6 +467,9 @@ void rb_grn_expression_finalizer (grn_ctx *context,
|
|
|
458
467
|
grn_obj *grn_object,
|
|
459
468
|
RbGrnExpression *rb_grn_expression);
|
|
460
469
|
|
|
470
|
+
VALUE rb_grn_posting_new (grn_posting *posting,
|
|
471
|
+
grn_id term_id);
|
|
472
|
+
|
|
461
473
|
VALUE rb_grn_record_new (VALUE table,
|
|
462
474
|
grn_id id,
|
|
463
475
|
VALUE values);
|
|
@@ -513,7 +525,7 @@ VALUE rb_grn_column_expression_builder_build
|
|
|
513
525
|
#define GRNTABLE2RVAL(context, table, owner) \
|
|
514
526
|
(rb_grn_table_to_ruby_object(context, table, owner))
|
|
515
527
|
|
|
516
|
-
#define RVAL2GRNTABLECURSOR(object) (rb_grn_table_cursor_from_ruby_object(object))
|
|
528
|
+
#define RVAL2GRNTABLECURSOR(object, context) (rb_grn_table_cursor_from_ruby_object(object, context))
|
|
517
529
|
#define GRNTABLECURSOR2RVAL(klass, context, cursor) \
|
|
518
530
|
(rb_grn_table_cursor_to_ruby_object(klass, context, cursor, GRN_TRUE))
|
|
519
531
|
#define GRNTABLECURSOR2RCLASS(object) (rb_grn_table_cursor_to_ruby_class(object))
|
|
@@ -523,6 +535,9 @@ VALUE rb_grn_column_expression_builder_build
|
|
|
523
535
|
#define GRNCOLUMN2RVAL(klass, context, column, owner) \
|
|
524
536
|
(rb_grn_column_to_ruby_object(klass, context, column, owner))
|
|
525
537
|
|
|
538
|
+
#define GRNINDEXCURSOR2RVAL(context, cursor) \
|
|
539
|
+
(rb_grn_index_cursor_to_ruby_object(context, cursor, GRN_TRUE))
|
|
540
|
+
|
|
526
541
|
#define RVAL2GRNACCESSOR(object) \
|
|
527
542
|
(rb_grn_accessor_from_ruby_object(object))
|
|
528
543
|
#define GRNACCESSOR2RVAL(context, accessor, owner) \
|
|
@@ -634,6 +649,9 @@ VALUE rb_grn_column_to_ruby_object (VALUE klass,
|
|
|
634
649
|
grn_ctx *context,
|
|
635
650
|
grn_obj *column,
|
|
636
651
|
grn_bool owner);
|
|
652
|
+
VALUE rb_grn_index_cursor_to_ruby_object (grn_ctx *context,
|
|
653
|
+
grn_obj *cursor,
|
|
654
|
+
grn_bool owner);
|
|
637
655
|
|
|
638
656
|
grn_query *rb_grn_query_from_ruby_object (VALUE object);
|
|
639
657
|
VALUE rb_grn_query_to_ruby_object (grn_ctx *context,
|
data/ext/groonga/rb-groonga.c
CHANGED
|
@@ -101,7 +101,7 @@ rb_grn_init_version (VALUE mGrn)
|
|
|
101
101
|
INT2NUM(RB_GRN_MICRO_VERSION));
|
|
102
102
|
rb_obj_freeze(bindings_version);
|
|
103
103
|
/*
|
|
104
|
-
*
|
|
104
|
+
* rroongaのバージョン。<tt>[メジャーバージョン, マ
|
|
105
105
|
* イナーバージョン, マイクロバージョン]</tt>の配列。
|
|
106
106
|
*/
|
|
107
107
|
rb_define_const(mGrn, "BINDINGS_VERSION", bindings_version);
|
|
@@ -129,6 +129,8 @@ Init_groonga (void)
|
|
|
129
129
|
rb_grn_init_database(mGrn);
|
|
130
130
|
rb_grn_init_table(mGrn);
|
|
131
131
|
rb_grn_init_table_cursor(mGrn);
|
|
132
|
+
rb_grn_init_index_cursor(mGrn);
|
|
133
|
+
rb_grn_init_posting(mGrn);
|
|
132
134
|
rb_grn_init_type(mGrn);
|
|
133
135
|
rb_grn_init_procedure(mGrn);
|
|
134
136
|
rb_grn_init_column(mGrn);
|
data/lib/groonga.rb
CHANGED
data/lib/groonga/dumper.rb
CHANGED
|
@@ -32,9 +32,11 @@ module Groonga
|
|
|
32
32
|
options[:context] ||= Groonga::Context.default
|
|
33
33
|
options[:database] = options[:context].database
|
|
34
34
|
end
|
|
35
|
+
options[:dump_plugins] = true if options[:dump_plugins].nil?
|
|
35
36
|
options[:dump_schema] = true if options[:dump_schema].nil?
|
|
36
37
|
options[:dump_tables] = true if options[:dump_tables].nil?
|
|
37
38
|
|
|
39
|
+
dump_plugins(options) if options[:dump_plugins]
|
|
38
40
|
dump_schema(options) if options[:dump_schema]
|
|
39
41
|
dump_tables(options) if options[:dump_tables]
|
|
40
42
|
|
|
@@ -46,6 +48,21 @@ module Groonga
|
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
private
|
|
51
|
+
def dump_plugins(options)
|
|
52
|
+
first_table = true
|
|
53
|
+
plugin_paths = {}
|
|
54
|
+
options[:database].each(:order_by => :id) do |object|
|
|
55
|
+
next unless object.is_a?(Groonga::Procedure)
|
|
56
|
+
next if object.builtin?
|
|
57
|
+
path = object.path
|
|
58
|
+
next if path.nil?
|
|
59
|
+
next if plugin_paths.has_key?(path)
|
|
60
|
+
plugin_paths[path] = true
|
|
61
|
+
dump_plugin(object, options)
|
|
62
|
+
end
|
|
63
|
+
options[:output].write("\n") unless plugin_paths.empty?
|
|
64
|
+
end
|
|
65
|
+
|
|
49
66
|
def dump_schema(options)
|
|
50
67
|
SchemaDumper.new(options.merge(:syntax => :command)).dump
|
|
51
68
|
end
|
|
@@ -55,7 +72,6 @@ module Groonga
|
|
|
55
72
|
options[:database].each(:order_by => :key) do |object|
|
|
56
73
|
next unless object.is_a?(Groonga::Table)
|
|
57
74
|
next if object.size.zero?
|
|
58
|
-
next if lexicon_table?(object)
|
|
59
75
|
next unless target_table?(options[:tables], object)
|
|
60
76
|
options[:output].write("\n") if !first_table or options[:dump_schema]
|
|
61
77
|
first_table = false
|
|
@@ -67,10 +83,14 @@ module Groonga
|
|
|
67
83
|
TableDumper.new(table, options).dump
|
|
68
84
|
end
|
|
69
85
|
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
def dump_plugin(plugin, options)
|
|
87
|
+
output = options[:output]
|
|
88
|
+
plugins_dir_re = Regexp.escape(Groonga::Plugin.system_plugins_dir)
|
|
89
|
+
suffix_re = Regexp.escape(Groonga::Plugin.suffix)
|
|
90
|
+
plugin_name = plugin.path.gsub!(/(?:\A#{plugins_dir_re}\/|
|
|
91
|
+
#{suffix_re}\z)/x,
|
|
92
|
+
'')
|
|
93
|
+
output.write("register #{plugin_name}\n")
|
|
74
94
|
end
|
|
75
95
|
|
|
76
96
|
def target_table?(target_tables, table)
|