meilisearch 0.32.0 → 0.33.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 +0 -1
- data/lib/meilisearch/client.rb +7 -2
- data/lib/meilisearch/http_request.rb +4 -0
- data/lib/meilisearch/index.rb +694 -16
- data/lib/meilisearch/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9ae113cf3a2e76decccea64b9bcd1a0402c56c22af08eecbc3ad4e022db482b
|
|
4
|
+
data.tar.gz: 6ee5da205a21e8343e4fcb64ffc51e9919feab370349a86b51efebde086f0195
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7594ebc7211f25bac52762dd9c0081e21979d604045c8e82d4e4ec0e1162eb826ff7c8fc1a27138e5487f2c0c64aba37c48c3a00c5e67f7d1c315e248333ae0c
|
|
7
|
+
data.tar.gz: 7898077e4b8aa6d3ae2e87e6238815f3f807143cde266e6b307a90490038e13dd8171d55b00d30de06392e540168aaf1c25d48e480caea49afc7c2d2c6fde54e
|
data/README.md
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
<img src="https://codecov.io/gh/meilisearch/meilisearch-ruby/branch/main/graph/badge.svg?token=9J7LRP11IR"/>
|
|
22
22
|
</a>
|
|
23
23
|
<a href="https://github.com/meilisearch/meilisearch-ruby/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
|
|
24
|
-
<a href="https://ms-bors.herokuapp.com/repositories/6"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
|
|
25
24
|
</p>
|
|
26
25
|
|
|
27
26
|
<p align="center">⚡ The Meilisearch API client written for Ruby 💎</p>
|
data/lib/meilisearch/client.rb
CHANGED
|
@@ -41,13 +41,18 @@ module Meilisearch
|
|
|
41
41
|
# Multiple swaps may be done with one request:
|
|
42
42
|
# client.swap_indexes(['a', 'a_swap'], ['b', 'b_swap'])
|
|
43
43
|
#
|
|
44
|
+
# You can also pass hashes explicitly (renaming supported):
|
|
45
|
+
# client.swap_indexes({ indexes: ['a', 'a_swap'] }, { indexes: ['uid', 'uid_renamed'], rename: true })
|
|
46
|
+
#
|
|
47
|
+
# Renaming requires the target uid to be absent.
|
|
48
|
+
#
|
|
44
49
|
# @see https://www.meilisearch.com/docs/reference/api/indexes#swap-indexes Meilisearch API reference
|
|
45
50
|
#
|
|
46
|
-
# @param options [Array<Array(String, String)>] the
|
|
51
|
+
# @param options [Array<Array(String, String)>, Array<Hash>] the index pairs to swap
|
|
47
52
|
# @return [Models::Task] the async task that swaps the indexes
|
|
48
53
|
# @raise [ApiError]
|
|
49
54
|
def swap_indexes(*options)
|
|
50
|
-
mapped_array = options.map { |
|
|
55
|
+
mapped_array = options.map { |entry| entry.is_a?(Hash) ? entry : { indexes: entry } }
|
|
51
56
|
|
|
52
57
|
response = http_post '/swap-indexes', mapped_array
|
|
53
58
|
Models::Task.new(response, task_endpoint)
|
|
@@ -118,6 +118,10 @@ module Meilisearch
|
|
|
118
118
|
response = http_method.call(@base_url + relative_path, request_config)
|
|
119
119
|
rescue Errno::ECONNREFUSED, Errno::EPIPE => e
|
|
120
120
|
raise CommunicationError, e.message
|
|
121
|
+
rescue URI::InvalidURIError => e
|
|
122
|
+
raise CommunicationError, "Client URL missing scheme/protocol. Did you mean https://#{@base_url}" unless @base_url =~ %r{^\w+://}
|
|
123
|
+
|
|
124
|
+
raise CommunicationError, e
|
|
121
125
|
rescue Net::OpenTimeout, Net::ReadTimeout => e
|
|
122
126
|
attempts += 1
|
|
123
127
|
raise TimeoutError, e.message unless attempts <= max_retries && safe_to_retry?(config[:method_type], e)
|