groonga-client 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +68 -10
- data/doc/text/news.md +10 -0
- data/lib/groonga/client.rb +1 -1
- data/lib/groonga/client/version.rb +1 -1
- metadata +17 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 106f3f7e0eb62f2b556ff7ad0b93f235146f7f71
|
4
|
+
data.tar.gz: ed8cd8b6dc4d4fee6c6d364e68c0ce0d2db42269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fac8ba9aa91b9bd477464f72276375fe48faefc62ad344a4ef3c8d667ff2664dc0a5ad114b09652d5ab9acba122cd8a5ff7ef31e66630b3c5bf59d2561977d9
|
7
|
+
data.tar.gz: 8c7080561b18c48447b7090a44bba4fcb5828cc8c15a837a6f7991e49b3a1cdc38dcde55d7cf68f6f4ab7164a20de30827dfc6a0691f5e3e0c15dc905dc2620a
|
data/README.md
CHANGED
@@ -6,13 +6,12 @@ groonga-client
|
|
6
6
|
|
7
7
|
## Description
|
8
8
|
|
9
|
-
Groonga-client is a client for
|
10
|
-
implemented with pure
|
9
|
+
Groonga-client is a client for Groonga (http://groonga.org/)
|
10
|
+
implemented with pure Ruby. You can use it without Groonga.
|
11
11
|
|
12
12
|
Groonga-client gem supports HTTP or
|
13
13
|
[GQTP (Groonga Query Transfer Protocol)](http://groonga.org/docs/spec/gqtp.html)
|
14
|
-
as the protocol using a client.
|
15
|
-
package.
|
14
|
+
as the protocol using a client.
|
16
15
|
|
17
16
|
## Install
|
18
17
|
|
@@ -20,27 +19,86 @@ package.
|
|
20
19
|
|
21
20
|
## Usage
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
Grooga-client handles protocol transparently, so there is only one
|
23
|
+
difference between HTTP and GQTP examples. It's `:protocol` parameter
|
24
|
+
value of `Groonga::Client.open`. It's `:http` for HTTP and `:gqtp` for
|
25
|
+
GQTP.
|
25
26
|
|
26
|
-
###
|
27
|
+
### HTTP
|
28
|
+
|
29
|
+
Here is a sample to get list of tables via HTTP protocol.
|
27
30
|
|
28
|
-
|
31
|
+
require "groonga/client"
|
32
|
+
|
33
|
+
host = "127.0.0.1"
|
34
|
+
protocol = :http
|
35
|
+
Groonga::Client.open(:host => host, :protocol => protocol) do |client|
|
29
36
|
tables = client.table_list
|
30
37
|
tables.each do |table|
|
31
38
|
table.name
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
35
|
-
###
|
42
|
+
### GQTP
|
36
43
|
|
37
|
-
|
44
|
+
Here is a sample to get list of tables via GQTP protocol.
|
45
|
+
|
46
|
+
require "groonga/client"
|
47
|
+
|
48
|
+
host = "127.0.0.1"
|
49
|
+
protocol = :gqtp
|
50
|
+
Groonga::Client.open(:host => host, :protocol => protocol) do |client|
|
38
51
|
tables = client.table_list
|
39
52
|
tables.each do |table|
|
40
53
|
table.name
|
41
54
|
end
|
42
55
|
end
|
43
56
|
|
57
|
+
### Typical example
|
58
|
+
|
59
|
+
Here is a typical example to learn usage of groonga-client. In this
|
60
|
+
example, it creates `User` table and `login_name` column. Then it
|
61
|
+
loads sample data and selects a person which contains `bob` as a key.
|
62
|
+
|
63
|
+
require "groonga/client"
|
64
|
+
|
65
|
+
host = "127.0.0.1"
|
66
|
+
protocol = :http
|
67
|
+
Groonga::Client.open(:host => host, :protocol => protocol) do |client|
|
68
|
+
client.table_create(:name => "User",
|
69
|
+
:flags => "TABLE_PAT_KEY",
|
70
|
+
:key_type => "ShortText")
|
71
|
+
client.column_create(:table => "User",
|
72
|
+
:name => "login_name",
|
73
|
+
:flags => "COLUMN_SCALAR",
|
74
|
+
:type => "ShortText")
|
75
|
+
values = [
|
76
|
+
{
|
77
|
+
"_key" => "bob",
|
78
|
+
"login_name" => "Bob"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"_key" => "tim",
|
82
|
+
"login_name" => "Tim"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"_key" => "jessie",
|
86
|
+
"login_name" => "Jessie"
|
87
|
+
},
|
88
|
+
]
|
89
|
+
client.load(:table => "User",
|
90
|
+
:values => values.to_json)
|
91
|
+
response = client.select(:table => "User", :query => "_key:bob")
|
92
|
+
if response.success?
|
93
|
+
puts response.n_hits
|
94
|
+
response.records.each do |record|
|
95
|
+
puts record["login_name"]
|
96
|
+
end
|
97
|
+
else
|
98
|
+
puts response.error_message
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
44
102
|
## Dependencies
|
45
103
|
|
46
104
|
* Ruby
|
data/doc/text/news.md
CHANGED
data/lib/groonga/client.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Haruka Yoshihara
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gqtp
|
@@ -155,8 +155,7 @@ dependencies:
|
|
155
155
|
description: |
|
156
156
|
Groonga-client gem supports HTTP or
|
157
157
|
[GQTP (Groonga Query Transfer Protocol)](http://groonga.org/docs/spec/gqtp.html)
|
158
|
-
as the protocol using a client.
|
159
|
-
package.
|
158
|
+
as the protocol using a client.
|
160
159
|
email:
|
161
160
|
- yshr04hrk@gmail.com
|
162
161
|
- kou@clear-code.com
|
@@ -253,26 +252,26 @@ rubyforge_project:
|
|
253
252
|
rubygems_version: 2.5.1
|
254
253
|
signing_key:
|
255
254
|
specification_version: 4
|
256
|
-
summary: Groonga-client is a client for
|
257
|
-
with pure
|
255
|
+
summary: Groonga-client is a client for Groonga (http://groonga.org/) implemented
|
256
|
+
with pure Ruby. You can use it without Groonga.
|
258
257
|
test_files:
|
259
|
-
- test/test-client.rb
|
260
258
|
- test/test-script-syntax.rb
|
261
|
-
- test/test-command.rb
|
262
|
-
- test/protocol/test-gqtp.rb
|
263
259
|
- test/protocol/test-http.rb
|
264
|
-
- test/
|
265
|
-
- test/response/test-base.rb
|
266
|
-
- test/response/test-column-list.rb
|
267
|
-
- test/response/helper.rb
|
268
|
-
- test/response/test-error.rb
|
269
|
-
- test/response/test-table-list.rb
|
270
|
-
- test/response/test-status.rb
|
260
|
+
- test/protocol/test-gqtp.rb
|
271
261
|
- test/response/test-schema.rb
|
262
|
+
- test/response/test-error.rb
|
263
|
+
- test/response/test-table-remove.rb
|
272
264
|
- test/response/test-select-command-version3.rb
|
265
|
+
- test/response/test-table-list.rb
|
266
|
+
- test/response/test-column-list.rb
|
267
|
+
- test/response/helper.rb
|
268
|
+
- test/response/test-base.rb
|
273
269
|
- test/response/test-select-command-version1.rb
|
270
|
+
- test/response/test-status.rb
|
274
271
|
- test/response/test-table-create.rb
|
275
|
-
- test/response/test-table-remove.rb
|
276
|
-
- test/results/test-column-list.rb
|
277
272
|
- test/results/test-table-list.rb
|
273
|
+
- test/results/test-column-list.rb
|
274
|
+
- test/test-command.rb
|
275
|
+
- test/run-test.rb
|
276
|
+
- test/test-client.rb
|
278
277
|
has_rdoc:
|