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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67e208675166b5145f2f6aac4d0bc0354741be56
4
- data.tar.gz: 1cb1905f24e1e1da9e89854adb2c7d0005896ec8
3
+ metadata.gz: 106f3f7e0eb62f2b556ff7ad0b93f235146f7f71
4
+ data.tar.gz: ed8cd8b6dc4d4fee6c6d364e68c0ce0d2db42269
5
5
  SHA512:
6
- metadata.gz: 1f30907804cd22d7ad8ea20a096386cc8711e790a1679393280c74f267a3d96776b68529f5ab0d304ac6a681684841e20d3f959fcf248a096867a9d0946721fe
7
- data.tar.gz: 36717b424a2160a875f457dd74a4f16d5d7e2025cf633241975b6afd35ec1d5bfea583949635967579dd715e3f5605239e0ca4b5a59d1c4e5e6c3e96ade699b4
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 groonga (http://groonga.org/)
10
- implemented with pure ruby.
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. You can use it without groonga
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
- TODO: use commands with parameters for examples
24
- (e.g. table_create, load, select)
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
- ### GQTP
27
+ ### HTTP
28
+
29
+ Here is a sample to get list of tables via HTTP protocol.
27
30
 
28
- Groonga::Client.open(:host => host, :port => port, :protocol => :gqtp) do |client|
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
- ### HTTP
42
+ ### GQTP
36
43
 
37
- Groonga::Client.open(:host => host, :port => port, :protocol => :http) do |client|
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
@@ -1,5 +1,15 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.2.8 - 2016-10-05
4
+
5
+ ### Improvements
6
+
7
+ * Added more documents.
8
+
9
+ ### Fixes
10
+
11
+ * `Groonga::Client#select`: Accepted string as parameter key again.
12
+
3
13
  ## 0.2.7 - 2016-08-19
4
14
 
5
15
  ### Improvements
@@ -178,7 +178,7 @@ module Groonga
178
178
 
179
179
  def method_missing(name, *args, **kwargs, &block)
180
180
  if groonga_command_name?(name)
181
- execute(name, *args, **kwargs, &block)
181
+ execute(name, *args, &block)
182
182
  else
183
183
  super
184
184
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  class Client
19
- VERSION = "0.2.7"
19
+ VERSION = "0.2.8"
20
20
  end
21
21
  end
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.7
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-08-19 00:00:00.000000000 Z
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. You can use it without groonga
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 groonga (http://groonga.org/) implemented
257
- with pure ruby.
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/run-test.rb
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: