rroonga 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/bin/grntest-log-analyze +123 -0
- data/bin/groonga-query-log-extract +117 -0
- data/ext/groonga/rb-grn-accessor.c +7 -5
- data/ext/groonga/rb-grn-array-cursor.c +1 -1
- data/ext/groonga/rb-grn-array.c +34 -44
- data/ext/groonga/rb-grn-column.c +74 -38
- data/ext/groonga/rb-grn-context.c +19 -15
- data/ext/groonga/rb-grn-database.c +47 -42
- data/ext/groonga/rb-grn-double-array-trie-cursor.c +40 -0
- data/ext/groonga/rb-grn-double-array-trie.c +530 -0
- data/ext/groonga/rb-grn-encoding-support.c +1 -1
- data/ext/groonga/rb-grn-encoding.c +1 -1
- data/ext/groonga/rb-grn-exception.c +1 -1
- data/ext/groonga/rb-grn-expression-builder.c +1 -1
- data/ext/groonga/rb-grn-expression.c +63 -51
- data/ext/groonga/rb-grn-fix-size-column.c +7 -7
- data/ext/groonga/rb-grn-hash-cursor.c +1 -1
- data/ext/groonga/rb-grn-hash.c +42 -39
- data/ext/groonga/rb-grn-index-column.c +35 -31
- data/ext/groonga/rb-grn-index-cursor.c +1 -1
- data/ext/groonga/rb-grn-logger.c +23 -18
- data/ext/groonga/rb-grn-object.c +40 -27
- data/ext/groonga/rb-grn-operator.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie-cursor.c +1 -1
- data/ext/groonga/rb-grn-patricia-trie.c +122 -90
- data/ext/groonga/rb-grn-plugin.c +8 -7
- data/ext/groonga/rb-grn-posting.c +1 -1
- data/ext/groonga/rb-grn-procedure.c +1 -1
- data/ext/groonga/rb-grn-query.c +12 -12
- data/ext/groonga/rb-grn-record.c +1 -1
- data/ext/groonga/rb-grn-snippet.c +26 -19
- data/ext/groonga/rb-grn-table-cursor-key-support.c +1 -1
- data/ext/groonga/rb-grn-table-cursor.c +4 -3
- data/ext/groonga/rb-grn-table-key-support.c +23 -23
- data/ext/groonga/rb-grn-table.c +268 -153
- data/ext/groonga/rb-grn-type.c +11 -7
- data/ext/groonga/rb-grn-utils.c +4 -1
- data/ext/groonga/rb-grn-variable-size-column.c +1 -1
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn-view-accessor.c +1 -1
- data/ext/groonga/rb-grn-view-cursor.c +1 -1
- data/ext/groonga/rb-grn-view-record.c +1 -1
- data/ext/groonga/rb-grn-view.c +43 -34
- data/ext/groonga/rb-grn.h +6 -2
- data/ext/groonga/rb-groonga.c +1 -1
- data/lib/groonga.rb +4 -2
- data/lib/groonga/context.rb +16 -41
- data/lib/groonga/dumper.rb +6 -4
- data/lib/groonga/expression-builder.rb +52 -26
- data/lib/groonga/grntest-log.rb +206 -0
- data/lib/groonga/pagination.rb +21 -19
- data/lib/groonga/patricia-trie.rb +7 -10
- data/lib/groonga/posting.rb +1 -1
- data/lib/groonga/query-log.rb +348 -0
- data/lib/groonga/record.rb +47 -143
- data/lib/groonga/schema.rb +679 -406
- data/lib/groonga/view-record.rb +4 -10
- data/rroonga-build.rb +1 -1
- data/test/test-array.rb +25 -4
- data/test/test-column.rb +8 -8
- data/test/test-database.rb +2 -3
- data/test/test-double-array-trie.rb +164 -0
- data/test/test-expression-builder.rb +2 -2
- data/test/test-expression.rb +10 -9
- data/test/test-gqtp.rb +2 -2
- data/test/test-hash.rb +32 -8
- data/test/test-patricia-trie.rb +34 -10
- data/test/test-query-log.rb +258 -0
- data/test/test-record.rb +6 -5
- data/test/test-schema-create-table.rb +8 -0
- data/test/test-schema.rb +491 -234
- data/test/test-table.rb +17 -24
- metadata +123 -100
- data/ext/groonga/Makefile +0 -233
data/ext/groonga/rb-grn-type.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -52,24 +52,28 @@ rb_grn_type_to_ruby_object (grn_ctx *context, grn_obj *type,
|
|
52
52
|
* call-seq:
|
53
53
|
* Groonga::Type.new(name, options={})
|
54
54
|
*
|
55
|
-
* 名前が_name_の型を作成する。_options_に指定可能な値は以下の通
|
55
|
+
* 名前が _name_ の型を作成する。 _options_ に指定可能な値は以下の通
|
56
56
|
* り。
|
57
|
+
* @param options [::Hash] The name and value
|
58
|
+
* pairs. Omitted names are initialized as the default value
|
59
|
+
* @option options :type (variable) The type
|
57
60
|
*
|
58
|
-
* [+:type+]
|
59
61
|
* :integer(符号付き整数)、:int(:integerの省略
|
60
62
|
* 形)、:unsigned_integer(符号なし整
|
61
63
|
* 数)、:uint(:unsigned_integerの省略形)、:float(浮動小
|
62
64
|
* 数点数)、:variable(可変長文字列)のいずれかを指定する。
|
63
65
|
* 省略した場合は:variableを指定したものと扱う。
|
64
66
|
*
|
65
|
-
* :variable
|
67
|
+
* :variableを指定した場合は必ず +:size+ を指定しなければいけない。
|
68
|
+
*
|
69
|
+
* @option options :context The context
|
66
70
|
*
|
67
|
-
* [+:context+]
|
68
71
|
* 型の作成時に利用するGroonga::Contextを指定する。省略すると
|
69
72
|
* Groonga::Context.defaultを用いる。
|
70
73
|
*
|
71
|
-
*
|
72
|
-
*
|
74
|
+
* @option options :size The size
|
75
|
+
*
|
76
|
+
* +:option+ が:variableの場合は最大長、それ以外の場合は長さを
|
73
77
|
* 指定する(単位:byte)。
|
74
78
|
*/
|
75
79
|
static VALUE
|
data/ext/groonga/rb-grn-utils.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/* vim: set sts=4 sw=4 ts=8 noet: */
|
3
3
|
/*
|
4
4
|
Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
|
@@ -222,6 +222,7 @@ rb_grn_bulk_to_ruby_object_by_range_type (grn_ctx *context, grn_obj *bulk,
|
|
222
222
|
switch (range->header.type) {
|
223
223
|
case GRN_TABLE_HASH_KEY:
|
224
224
|
case GRN_TABLE_PAT_KEY:
|
225
|
+
case GRN_TABLE_DAT_KEY:
|
225
226
|
case GRN_TABLE_NO_KEY:
|
226
227
|
{
|
227
228
|
grn_id id;
|
@@ -765,6 +766,7 @@ rb_grn_key_from_ruby_object (VALUE rb_key, grn_ctx *context,
|
|
765
766
|
break;
|
766
767
|
case GRN_TABLE_HASH_KEY:
|
767
768
|
case GRN_TABLE_PAT_KEY:
|
769
|
+
case GRN_TABLE_DAT_KEY:
|
768
770
|
case GRN_TABLE_NO_KEY:
|
769
771
|
id = RVAL2GRNID(rb_key, context, domain, related_object);
|
770
772
|
break;
|
@@ -836,6 +838,7 @@ rb_grn_obj_to_ruby_object (VALUE klass, grn_ctx *context,
|
|
836
838
|
/* case GRN_EXPR: */
|
837
839
|
/* case GRN_TABLE_HASH_KEY: */
|
838
840
|
/* case GRN_TABLE_PAT_KEY: */
|
841
|
+
/* case GRN_TABLE_DAT_KEY: */
|
839
842
|
/* case GRN_TABLE_NO_KEY: */
|
840
843
|
/* case GRN_DB: */
|
841
844
|
/* case GRN_COLUMN_FIX_SIZE: */
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -81,7 +81,7 @@ rb_grn_variable_get_value (VALUE self)
|
|
81
81
|
* call-seq:
|
82
82
|
* variable.value=(value)
|
83
83
|
*
|
84
|
-
* 変数の値を_value_に設定する。
|
84
|
+
* 変数の値を _value_ に設定する。
|
85
85
|
*/
|
86
86
|
static VALUE
|
87
87
|
rb_grn_variable_set_value (VALUE self, VALUE value)
|
data/ext/groonga/rb-grn-view.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* -*- c-file-style: "ruby" -*- */
|
1
|
+
/* -*- coding: utf-8; c-file-style: "ruby" -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2010-2011 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
|
@@ -47,45 +47,51 @@ VALUE rb_cGrnView;
|
|
47
47
|
* ビューにテーブルを追加するときはGroonga::View#add_tableを
|
48
48
|
* 使う。
|
49
49
|
*
|
50
|
-
* _options_に指定可能な値は以下の通り。
|
50
|
+
* _options_ に指定可能な値は以下の通り。
|
51
|
+
* @param options [::Hash] The name and value
|
52
|
+
* pairs. Omitted names are initialized as the default value
|
53
|
+
* @option options :context (Groonga::Context.default)
|
51
54
|
*
|
52
|
-
*
|
53
|
-
*
|
54
|
-
*
|
55
|
+
* ビューが利用するGroonga::Context。
|
56
|
+
*
|
57
|
+
* @option options :name The view name
|
55
58
|
*
|
56
|
-
* [+:name+]
|
57
59
|
* ビューの名前。名前をつけると、Groonga::Context#[]に名
|
58
60
|
* 前を指定してビューを取得することができる。省略すると
|
59
61
|
* 無名ビューになり、ビューIDでのみ取得できる。
|
60
62
|
*
|
61
|
-
*
|
63
|
+
* @option options :path The path
|
64
|
+
*
|
62
65
|
* ビューを保存するパス。パスを指定すると永続ビューとな
|
63
66
|
* り、プロセス終了後もレコードは保持される。次回起動時に
|
64
67
|
* Groonga::View.openで保存されたビューを利用することが
|
65
68
|
* できる。省略すると一時ビューになり、プロセスが終了する
|
66
69
|
* とビューは破棄される。
|
67
70
|
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
+
* @option options :persistent The persistent
|
72
|
+
*
|
73
|
+
* +true+ を指定すると永続ビューとなる。 +path+ を省略した
|
74
|
+
* 場合は自動的にパスが付加される。 +:context+ で指定した
|
71
75
|
* Groonga::Contextに結びついているデータベースが一時デー
|
72
76
|
* タベースの場合は例外が発生する。
|
73
77
|
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
* Groonga::View.create
|
78
|
+
* @example
|
79
|
+
* 無名一時ビューを生成する。
|
80
|
+
* Groonga::View.create
|
78
81
|
*
|
79
|
-
*
|
80
|
-
*
|
82
|
+
* @example
|
83
|
+
* 無名永続ビューを生成する。
|
84
|
+
* Groonga::View.create(:path => "/tmp/view.grn")
|
81
85
|
*
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*
|
86
|
+
* @example
|
87
|
+
* 名前付き永続ビューを生成する。ただし、ファイル名は気に
|
88
|
+
* しない。
|
89
|
+
* Groonga::View.create(:name => "Entries",
|
90
|
+
* :persistent => true)
|
86
91
|
*
|
87
|
-
*
|
88
|
-
*
|
92
|
+
* @example
|
93
|
+
* +Users+ テーブルと +Dogs+ テーブルを横断検索するための
|
94
|
+
* るビューを生成する。
|
89
95
|
* entries = Groonga::View.create(:name => "Entries")
|
90
96
|
* entries.add_table("Users")
|
91
97
|
* entries.add_table("Dogs")
|
@@ -141,7 +147,7 @@ rb_grn_view_s_create (int argc, VALUE *argv, VALUE klass)
|
|
141
147
|
* call-seq:
|
142
148
|
* view.add_table(table)
|
143
149
|
*
|
144
|
-
* _table_をビューからアクセスできるようにする。
|
150
|
+
* _table_ をビューからアクセスできるようにする。
|
145
151
|
*/
|
146
152
|
static VALUE
|
147
153
|
rb_grn_view_add_table (VALUE self, VALUE rb_table)
|
@@ -218,7 +224,7 @@ rb_grn_view_each (VALUE self)
|
|
218
224
|
* call-seq:
|
219
225
|
* view.column_value(id, name) -> 値
|
220
226
|
*
|
221
|
-
* _view_の_id_に対応するカラム_name_の値を返す。
|
227
|
+
* _view_ の _id_ に対応するカラム _name_ の値を返す。
|
222
228
|
*/
|
223
229
|
static VALUE
|
224
230
|
rb_grn_view_get_column_value (VALUE self, VALUE rb_id, VALUE rb_name)
|
@@ -256,25 +262,28 @@ rb_grn_view_get_column_value (VALUE self, VALUE rb_id, VALUE rb_name)
|
|
256
262
|
* call-seq:
|
257
263
|
* view.sort(keys, options={}) -> Groonga::ViewRecordの配列
|
258
264
|
*
|
259
|
-
* テーブルに登録されているレコードを_keys_で指定されたルー
|
265
|
+
* テーブルに登録されているレコードを _keys_ で指定されたルー
|
260
266
|
* ルに従ってソートしたレコードの配列を返す。
|
261
|
-
*
|
262
|
-
* [
|
267
|
+
* <pre>
|
268
|
+
* ==[
|
263
269
|
* {:key => "カラム名", :order => :asc, :ascending,
|
264
270
|
* :desc, :descendingのいずれか},
|
265
271
|
* {:key => "カラム名", :order => :asc, :ascending,
|
266
272
|
* :desc, :descendingのいずれか},
|
267
273
|
* ...,
|
268
|
-
* ]
|
269
|
-
*
|
270
|
-
* _options_に指定可能な値は以下の通り。
|
274
|
+
* ]==
|
275
|
+
* </pre>
|
276
|
+
* _options_ に指定可能な値は以下の通り。
|
277
|
+
* @param options [::Hash] The name and value
|
278
|
+
* pairs. Omitted names are initialized as the default value
|
279
|
+
* @option options :offset The offset
|
271
280
|
*
|
272
|
-
*
|
273
|
-
* ソートされたレコードのうち、(0ベースで)_:offset_番目
|
281
|
+
* ソートされたレコードのうち、(0ベースで) _:offset_ 番目
|
274
282
|
* からレコードを取り出す。
|
275
283
|
*
|
276
|
-
*
|
277
|
-
*
|
284
|
+
* @option options :limit The limit
|
285
|
+
*
|
286
|
+
* ソートされたレコードのうち、 _:limit_ 件のみを取り出す。
|
278
287
|
* 省略された場合または-1が指定された場合は、全件が指定され
|
279
288
|
* たものとみなす。
|
280
289
|
*/
|
data/ext/groonga/rb-grn.h
CHANGED
@@ -71,8 +71,8 @@ RB_GRN_BEGIN_DECLS
|
|
71
71
|
#endif
|
72
72
|
|
73
73
|
#define RB_GRN_MAJOR_VERSION 1
|
74
|
-
#define RB_GRN_MINOR_VERSION
|
75
|
-
#define RB_GRN_MICRO_VERSION
|
74
|
+
#define RB_GRN_MINOR_VERSION 3
|
75
|
+
#define RB_GRN_MICRO_VERSION 0
|
76
76
|
|
77
77
|
#define RB_GRN_QUERY_DEFAULT_MAX_EXPRESSIONS 32
|
78
78
|
|
@@ -206,12 +206,14 @@ RB_GRN_VAR VALUE rb_cGrnTable;
|
|
206
206
|
RB_GRN_VAR VALUE rb_mGrnTableKeySupport;
|
207
207
|
RB_GRN_VAR VALUE rb_cGrnHash;
|
208
208
|
RB_GRN_VAR VALUE rb_cGrnPatriciaTrie;
|
209
|
+
RB_GRN_VAR VALUE rb_cGrnDoubleArrayTrie;
|
209
210
|
RB_GRN_VAR VALUE rb_cGrnArray;
|
210
211
|
RB_GRN_VAR VALUE rb_cGrnView;
|
211
212
|
RB_GRN_VAR VALUE rb_cGrnTableCursor;
|
212
213
|
RB_GRN_VAR VALUE rb_mGrnTableCursorKeySupport;
|
213
214
|
RB_GRN_VAR VALUE rb_cGrnHashCursor;
|
214
215
|
RB_GRN_VAR VALUE rb_cGrnPatriciaTrieCursor;
|
216
|
+
RB_GRN_VAR VALUE rb_cGrnDoubleArrayTrieCursor;
|
215
217
|
RB_GRN_VAR VALUE rb_cGrnViewCursor;
|
216
218
|
RB_GRN_VAR VALUE rb_cGrnArrayCursor;
|
217
219
|
RB_GRN_VAR VALUE rb_cGrnType;
|
@@ -247,12 +249,14 @@ void rb_grn_init_table_key_support (VALUE mGrn);
|
|
247
249
|
void rb_grn_init_array (VALUE mGrn);
|
248
250
|
void rb_grn_init_hash (VALUE mGrn);
|
249
251
|
void rb_grn_init_patricia_trie (VALUE mGrn);
|
252
|
+
void rb_grn_init_double_array_trie (VALUE mGrn);
|
250
253
|
void rb_grn_init_view (VALUE mGrn);
|
251
254
|
void rb_grn_init_table_cursor (VALUE mGrn);
|
252
255
|
void rb_grn_init_table_cursor_key_support (VALUE mGrn);
|
253
256
|
void rb_grn_init_array_cursor (VALUE mGrn);
|
254
257
|
void rb_grn_init_hash_cursor (VALUE mGrn);
|
255
258
|
void rb_grn_init_patricia_trie_cursor (VALUE mGrn);
|
259
|
+
void rb_grn_init_double_array_trie_cursor (VALUE mGrn);
|
256
260
|
void rb_grn_init_view_cursor (VALUE mGrn);
|
257
261
|
void rb_grn_init_type (VALUE mGrn);
|
258
262
|
void rb_grn_init_procedure (VALUE mGrn);
|
data/ext/groonga/rb-groonga.c
CHANGED
data/lib/groonga.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
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
|
@@ -39,7 +39,7 @@ require 'groonga/record'
|
|
39
39
|
require 'groonga/expression-builder'
|
40
40
|
require 'groonga/posting'
|
41
41
|
begin
|
42
|
-
major, minor,
|
42
|
+
major, minor, _ = RUBY_VERSION.split(/\./)
|
43
43
|
require "#{major}.#{minor}/groonga.so"
|
44
44
|
rescue LoadError
|
45
45
|
require 'groonga.so'
|
@@ -91,3 +91,5 @@ require 'groonga/patricia-trie'
|
|
91
91
|
require 'groonga/dumper'
|
92
92
|
require 'groonga/schema'
|
93
93
|
require 'groonga/pagination'
|
94
|
+
require 'groonga/query-log'
|
95
|
+
require 'groonga/grntest-log'
|
data/lib/groonga/context.rb
CHANGED
@@ -17,10 +17,7 @@
|
|
17
17
|
|
18
18
|
module Groonga
|
19
19
|
class Context
|
20
|
-
#
|
21
|
-
# context.open_database(path) -> Groonga::Database
|
22
|
-
#
|
23
|
-
# _path_にある既存のデータベースを開く。ブロックを指定した場
|
20
|
+
# _path_ にある既存のデータベースを開く。ブロックを指定した場
|
24
21
|
# 合はブロックに開いたデータベースを渡し、ブロックを抜けると
|
25
22
|
# きに閉じる。
|
26
23
|
def open_database(path, &block)
|
@@ -29,18 +26,14 @@ module Groonga
|
|
29
26
|
Database.open(path, options, &block)
|
30
27
|
end
|
31
28
|
|
32
|
-
#
|
33
|
-
# context.create_database(path=nil) -> Groonga::Database
|
34
|
-
#
|
35
|
-
# _path_に新しくデータベースを作成する。_path_を省略すると
|
29
|
+
# _path_ に新しくデータベースを作成する。 _path_ を省略すると
|
36
30
|
# 一時データベースとなる。
|
37
31
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# 一時データベースを作成:
|
32
|
+
# @example
|
33
|
+
# #一時データベースを作成:
|
41
34
|
# context.create_database
|
42
35
|
#
|
43
|
-
#
|
36
|
+
# #永続データベースを作成:
|
44
37
|
# context.create_database("/tmp/db.groonga")
|
45
38
|
def create_database(path=nil)
|
46
39
|
options = {:context => self}
|
@@ -51,12 +44,8 @@ module Groonga
|
|
51
44
|
Database.create(options)
|
52
45
|
end
|
53
46
|
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# context.register_plugin({:path => path})
|
57
|
-
#
|
58
|
-
# groongaのプラグインディレクトリにあるプラグイン_name_
|
59
|
-
# を登録する。_path_を指定するとプラグインディレクトリ以
|
47
|
+
# groongaのプラグインディレクトリにあるプラグイン _name_
|
48
|
+
# を登録する。 _path_ を指定するとプラグインディレクトリ以
|
60
49
|
# 外にあるプラグインを登録することができる。
|
61
50
|
def register_plugin(name_or_options)
|
62
51
|
options = {:context => self}
|
@@ -68,19 +57,17 @@ module Groonga
|
|
68
57
|
end
|
69
58
|
end
|
70
59
|
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
# _table_から指定した条件にマッチするレコードの値を取得
|
75
|
-
# する。_table_はテーブル名かテーブルオブジェクトを指定
|
60
|
+
# _table_ から指定した条件にマッチするレコードの値を取得
|
61
|
+
# する。 _table_ はテーブル名かテーブルオブジェクトを指定
|
76
62
|
# する。
|
77
63
|
#
|
78
|
-
# _options_に指定できるキーは以下の通り。
|
64
|
+
# _options_ に指定できるキーは以下の通り。
|
65
|
+
# @param [::Hash] options The name and value
|
66
|
+
# pairs. Omitted names are initialized as the default value.
|
67
|
+
# @option options [Array] output_columns The output_columns
|
79
68
|
#
|
80
|
-
#
|
81
|
-
# [
|
82
|
-
#
|
83
|
-
# 例:
|
69
|
+
# 値を取得するカラムを指定する。
|
70
|
+
# @option options [Array] XXX TODO
|
84
71
|
# TODO
|
85
72
|
def select(table, options={})
|
86
73
|
select = SelectCommand.new(self, table, options)
|
@@ -91,7 +78,7 @@ module Groonga
|
|
91
78
|
:drill_down)
|
92
79
|
class << self
|
93
80
|
def parse(json, drill_down_keys)
|
94
|
-
select_result, *drill_down_results =
|
81
|
+
select_result, *drill_down_results = JSON.parse(json)
|
95
82
|
result = new
|
96
83
|
n_hits, columns, values = extract_result(select_result)
|
97
84
|
result.n_hits = n_hits
|
@@ -144,18 +131,6 @@ module Groonga
|
|
144
131
|
value
|
145
132
|
end
|
146
133
|
end
|
147
|
-
|
148
|
-
begin
|
149
|
-
require 'json'
|
150
|
-
def parse_json(json)
|
151
|
-
JSON.parse(json)
|
152
|
-
end
|
153
|
-
rescue LoadError
|
154
|
-
require 'yaml'
|
155
|
-
def parse_json(json)
|
156
|
-
YAML.load(json)
|
157
|
-
end
|
158
|
-
end
|
159
134
|
end
|
160
135
|
|
161
136
|
def records
|
data/lib/groonga/dumper.rb
CHANGED
@@ -49,7 +49,6 @@ module Groonga
|
|
49
49
|
|
50
50
|
private
|
51
51
|
def dump_plugins(options)
|
52
|
-
first_table = true
|
53
52
|
plugin_paths = {}
|
54
53
|
options[:database].each(:order_by => :id) do |object|
|
55
54
|
next unless object.is_a?(Groonga::Procedure)
|
@@ -138,7 +137,8 @@ module Groonga
|
|
138
137
|
end
|
139
138
|
end
|
140
139
|
|
141
|
-
|
140
|
+
# @private
|
141
|
+
class BaseSyntax
|
142
142
|
def initialize(database, output)
|
143
143
|
@database = database
|
144
144
|
@output = output
|
@@ -223,7 +223,8 @@ module Groonga
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
|
226
|
+
# @private
|
227
|
+
class RubySyntax < BaseSyntax
|
227
228
|
private
|
228
229
|
def create_table_header(table)
|
229
230
|
parameters = []
|
@@ -347,7 +348,8 @@ module Groonga
|
|
347
348
|
end
|
348
349
|
end
|
349
350
|
|
350
|
-
|
351
|
+
# @private
|
352
|
+
class CommandSyntax < BaseSyntax
|
351
353
|
private
|
352
354
|
def create_table_header(table)
|
353
355
|
parameters = []
|