elastic-app-search 7.6.0 → 7.7.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 +5 -4
- data/lib/elastic/app-search/version.rb +1 -1
- data/spec/client_spec.rb +26 -10
- data/spec/documents_spec.rb +0 -29
- data/spec/list_documents_spec.rb +25 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c0cd8147b4d6680f795a5bce7c7762904d455ffdde64aa97dbf54e3dc3ee441
|
4
|
+
data.tar.gz: dbc4687de2395b7537f1358c78fb08e7d5f9ff5508af3bfe3776d91b0f8ee4d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de8c65f62112e437c59f7a6920ac0b6dedb15a7773d90ce508facb68637485e2e0f88fa9f6022edc8a47fb612f9b213543f5366958c00be0ebec9decc1fc7cf3
|
7
|
+
data.tar.gz: '0676845f7195fb8bfcc1ed486dde287136e8f9313765b07722f99cabf43491437f3a9c5e83128260561f1f5ada3f4bb057402296b8d8eda66c92a0b168f03488'
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ To install the gem, execute:
|
|
25
25
|
gem install elastic-app-search
|
26
26
|
```
|
27
27
|
|
28
|
-
Or place `gem 'elastic-app-search', '~> 7.
|
28
|
+
Or place `gem 'elastic-app-search', '~> 7.7.0'` in your `Gemfile` and run `bundle install`.
|
29
29
|
|
30
30
|
## Versioning
|
31
31
|
|
@@ -55,12 +55,12 @@ Note:
|
|
55
55
|
|
56
56
|
The `[API_KEY]` authenticates requests to the API.
|
57
57
|
You can use any key type with the client, however each has a different scope.
|
58
|
-
For more information on keys, check out the [documentation](https://swiftype.com/documentation/app-search/credentials).
|
58
|
+
For more information on keys, check out the [documentation](https://swiftype.com/documentation/app-search/api/credentials).
|
59
59
|
|
60
60
|
##### Swiftype.com App Search users:
|
61
61
|
|
62
62
|
When using the [SaaS version available on swiftype.com](https://app.swiftype.com/as) of App Search, you can configure the client using your `[HOST_IDENTIFIER]` instead of the `[API_ENDPOINT]`.
|
63
|
-
The `[HOST_IDENTIFIER]` can be found within the [Credentials](https://app.swiftype.com/
|
63
|
+
The `[HOST_IDENTIFIER]` can be found within the [Credentials](https://app.swiftype.com/as#/credentials) menu.
|
64
64
|
|
65
65
|
```ruby
|
66
66
|
require 'elastic-app-search'
|
@@ -315,7 +315,8 @@ enforced_options = {
|
|
315
315
|
|
316
316
|
signed_search_key = Elastic::AppSearch::Client.create_signed_search_key(public_search_key, public_search_key_name, enforced_options)
|
317
317
|
|
318
|
-
client = Elastic::AppSearch::Client.new(
|
318
|
+
client = Elastic::AppSearch::Client.new(:api_key => signed_search_key, :api_endpoint => 'http://localhost:3002/api/as/v1/')
|
319
|
+
|
319
320
|
client.search('national-parks-demo', 'everglade')
|
320
321
|
```
|
321
322
|
|
data/spec/client_spec.rb
CHANGED
@@ -27,17 +27,33 @@ describe Elastic::AppSearch::Client do
|
|
27
27
|
|
28
28
|
describe 'Requests' do
|
29
29
|
it 'should include client name and version in headers' do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
if (client_options[:api_endpoint])
|
31
|
+
stub_request(:any, "#{client_options[:api_endpoint]}engines")
|
32
|
+
client.list_engines
|
33
|
+
expect(WebMock).to(
|
34
|
+
have_requested(:get, "#{client_options[:api_endpoint]}engines")
|
35
|
+
.with(
|
36
|
+
:headers => {
|
37
|
+
'X-Swiftype-Client' => 'elastic-app-search-ruby',
|
38
|
+
'X-Swiftype-Client-Version' => Elastic::AppSearch::VERSION
|
39
|
+
}
|
40
|
+
)
|
39
41
|
)
|
40
|
-
|
42
|
+
else
|
43
|
+
# CI runs against saas, so we keep this around for now. CI should be updated
|
44
|
+
# to use slef-managed and we should drop support "host_identifier" this.
|
45
|
+
stub_request(:any, "#{client_options[:host_identifier]}.api.swiftype.com/api/as/v1/engines")
|
46
|
+
client.list_engines
|
47
|
+
expect(WebMock).to(
|
48
|
+
have_requested(:get, "https://#{client_options[:host_identifier]}.api.swiftype.com/api/as/v1/engines")
|
49
|
+
.with(
|
50
|
+
:headers => {
|
51
|
+
'X-Swiftype-Client' => 'elastic-app-search-ruby',
|
52
|
+
'X-Swiftype-Client-Version' => Elastic::AppSearch::VERSION
|
53
|
+
}
|
54
|
+
)
|
55
|
+
)
|
56
|
+
end
|
41
57
|
end
|
42
58
|
end
|
43
59
|
|
data/spec/documents_spec.rb
CHANGED
@@ -126,34 +126,5 @@ describe Elastic::AppSearch::Client::Documents do
|
|
126
126
|
expect(response[1]['id']).to(eq(second_document_id))
|
127
127
|
end
|
128
128
|
end
|
129
|
-
|
130
|
-
describe '#list_documents' do
|
131
|
-
let(:documents) { [first_document, second_document] }
|
132
|
-
let(:first_document_id) { 'id' }
|
133
|
-
let(:first_document) { { 'id' => first_document_id, 'url' => 'https://www.youtube.com/watch?v=v1uyQZNg2vE' } }
|
134
|
-
let(:second_document_id) { 'another_id' }
|
135
|
-
let(:second_document) { { 'id' => second_document_id, 'url' => 'https://www.youtube.com/watch?v=9T1vfsHYiKY' } }
|
136
|
-
|
137
|
-
before do
|
138
|
-
client.index_documents(engine_name, documents)
|
139
|
-
end
|
140
|
-
|
141
|
-
context 'when no options are specified' do
|
142
|
-
it 'will return all documents' do
|
143
|
-
response = client.list_documents(engine_name)
|
144
|
-
expect(response['results'].size).to(eq(2))
|
145
|
-
expect(response['results'][0]['id']).to(eq(first_document_id))
|
146
|
-
expect(response['results'][1]['id']).to(eq(second_document_id))
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
context 'when options are specified' do
|
151
|
-
it 'will return all documents' do
|
152
|
-
response = client.list_documents(engine_name, :page => { :size => 1, :current => 2 })
|
153
|
-
expect(response['results'].size).to(eq(1))
|
154
|
-
expect(response['results'][0]['id']).to(eq(second_document_id))
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
129
|
end
|
159
130
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe Elastic::AppSearch::Client::Documents do
|
2
|
+
include_context 'App Search Credentials'
|
3
|
+
include_context 'Static Test Engine'
|
4
|
+
|
5
|
+
let(:client) { Elastic::AppSearch::Client.new(client_options) }
|
6
|
+
|
7
|
+
context 'Documents' do
|
8
|
+
describe '#list_documents' do
|
9
|
+
context 'when no options are specified' do
|
10
|
+
it 'will return all documents' do
|
11
|
+
response = client.list_documents(engine_name)
|
12
|
+
expect(response['results'].size).to(eq(2))
|
13
|
+
expect(response['results'].map { |d| d['id'] }).to(include(document1['id'], document2['id']))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when options are specified' do
|
18
|
+
it 'will return all documents' do
|
19
|
+
response = client.list_documents(engine_name, :page => { :size => 1, :current => 2 })
|
20
|
+
expect(response['results'].size).to(eq(1))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-app-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quin Hoxie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- spec/documents_spec.rb
|
136
136
|
- spec/engines_spec.rb
|
137
137
|
- spec/exceptions_spec.rb
|
138
|
+
- spec/list_documents_spec.rb
|
138
139
|
- spec/logs_spec.rb
|
139
140
|
- spec/meta_engines_spec.rb
|
140
141
|
- spec/query_suggestion_spec.rb
|
@@ -176,6 +177,7 @@ test_files:
|
|
176
177
|
- spec/documents_spec.rb
|
177
178
|
- spec/engines_spec.rb
|
178
179
|
- spec/exceptions_spec.rb
|
180
|
+
- spec/list_documents_spec.rb
|
179
181
|
- spec/logs_spec.rb
|
180
182
|
- spec/meta_engines_spec.rb
|
181
183
|
- spec/query_suggestion_spec.rb
|