aliyun_open_search 0.5.0 → 0.6.0
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.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/aliyun_open_search.rb +1 -0
- data/lib/aliyun_open_search/scan.rb +0 -2
- data/lib/aliyun_open_search/suggest.rb +21 -0
- data/lib/aliyun_open_search/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1f0bb78d83e9c5ae851f0e0516d42eeafc3a76f
|
4
|
+
data.tar.gz: 1303b0dc81653c0215474fa73700a8e06cded882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8f046d8c16a0ada13d3faa6f375c548278f63c2e630a9891e35be261203f5a6554f44d4834da704326a18dd1a76610ede00eae09510d01fc7e2f98e5bc34ca5
|
7
|
+
data.tar.gz: 7da9555c64bc94abebea7cc39327f0c3ec8856290b882448171ff449c48da5a40f84fe9b07320b35a15aa1dc77e768102773fbc996420c4ef3b7c8a870fc4167
|
data/README.md
CHANGED
@@ -197,6 +197,23 @@ scan_service.result # 获取结果
|
|
197
197
|
|
198
198
|
```
|
199
199
|
|
200
|
+
### 下拉提示
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
require "aliyun_open_search"
|
204
|
+
|
205
|
+
# index_names 是阿里云应用名称,只能一个
|
206
|
+
# params 的内容按照阿里云文档中的约定组织
|
207
|
+
|
208
|
+
params = {
|
209
|
+
query: "test",
|
210
|
+
suggest_name: "test_suggest",
|
211
|
+
hit: 10
|
212
|
+
}
|
213
|
+
|
214
|
+
AliyunOpenSearch::Suggest.new("test_suggest").execute(params)
|
215
|
+
|
216
|
+
```
|
200
217
|
|
201
218
|
### 测试
|
202
219
|
##### 大部分时候, 我们并不需要真正的发出请求, 需要mock掉
|
data/lib/aliyun_open_search.rb
CHANGED
@@ -23,7 +23,6 @@ module AliyunOpenSearch
|
|
23
23
|
Base.format_params(
|
24
24
|
custom_params.merge(
|
25
25
|
"index_name" => @index_names,
|
26
|
-
# "config" => "config=hit:#{@hit},format:#{@format}",
|
27
26
|
"scroll" => @scroll,
|
28
27
|
"search_type" => "scan"
|
29
28
|
)
|
@@ -38,7 +37,6 @@ module AliyunOpenSearch
|
|
38
37
|
Base.format_params(
|
39
38
|
custom_params.merge(
|
40
39
|
"index_name" => @index_names,
|
41
|
-
# "config" => "config=hit:#{@hit},format:#{@format}",
|
42
40
|
"scroll" => @scroll,
|
43
41
|
"scroll_id" => @scroll_id
|
44
42
|
)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AliyunOpenSearch
|
2
|
+
class Suggest < Base
|
3
|
+
attr_reader :index_names
|
4
|
+
|
5
|
+
def initialize(index_names)
|
6
|
+
super()
|
7
|
+
@base_url = "#{ENV["OPEN_SEARCH_HOST"]}/suggest"
|
8
|
+
@index_names = index_names
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute(custom_params)
|
12
|
+
params = basic_params.merge(
|
13
|
+
Base.format_params(custom_params.merge("index_name" => index_names))
|
14
|
+
)
|
15
|
+
|
16
|
+
Net::HTTP.get(
|
17
|
+
uri(params.merge("Signature" => Suggest.signature(params)))
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun_open_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lcp
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/aliyun_open_search/base.rb
|
106
106
|
- lib/aliyun_open_search/scan.rb
|
107
107
|
- lib/aliyun_open_search/search.rb
|
108
|
+
- lib/aliyun_open_search/suggest.rb
|
108
109
|
- lib/aliyun_open_search/syncs.rb
|
109
110
|
- lib/aliyun_open_search/version.rb
|
110
111
|
homepage: https://github.com/LcpMarvel/aliyun_open_search
|