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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd711e537ab1099eb436c4aba83776bc980a797b
4
- data.tar.gz: 4058e157e170c2c151b3e1d10a0e427f5813ebbb
3
+ metadata.gz: b1f0bb78d83e9c5ae851f0e0516d42eeafc3a76f
4
+ data.tar.gz: 1303b0dc81653c0215474fa73700a8e06cded882
5
5
  SHA512:
6
- metadata.gz: e64d13027ac1abda9c8644eb886fbd7ca983035fe858301f850efe4dd090ed2b07af0b514a2a5c7766a12f326fd86de8f788d7562b56fcc393fbb41df1779e6c
7
- data.tar.gz: a86f711a1476486297dc2b541c347b491fa5b16d69d8502bf191d85e664d9c618baa6918ae5fdd20dbaf2d668da2b5e17c4498a6a2611c50272c07e1de961d8f
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掉
@@ -3,6 +3,7 @@ require "aliyun_open_search/base"
3
3
  require "aliyun_open_search/syncs"
4
4
  require "aliyun_open_search/search"
5
5
  require "aliyun_open_search/scan"
6
+ require "aliyun_open_search/suggest"
6
7
 
7
8
  module AliyunOpenSearch
8
9
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module AliyunOpenSearch
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  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.5.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-08-20 00:00:00.000000000 Z
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