meilisearch 0.20.0 โ 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -18
- data/lib/meilisearch/client.rb +14 -0
- data/lib/meilisearch/http_request.rb +2 -1
- data/lib/meilisearch/index.rb +3 -5
- data/lib/meilisearch/task.rb +16 -6
- data/lib/meilisearch/utils.rb +10 -0
- data/lib/meilisearch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 012ab51bfcb13141e38b43587639b9f0c87c15b390025008b19edb78d3c6f8cd
|
4
|
+
data.tar.gz: 101f00e8a3507911aa17481466ffcffbd1c586c455eb8a15eac85ccf4d8e0b8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87837129a31b9e962957f148525877ffddcdfb4e4e2e36b43cfdeb5f66e0f0e1e95ee8cef3650433156f59c9a70c6d6dccff8110f333214cd9983a996895cd0e
|
7
|
+
data.tar.gz: c3960dc5623ec4629324b113210596744a482c5411046b9e1ea62c5906f2aae600c2c8bdf9aceb3306b6b2a97dce5eddfc4844307feb96a74e4d74b5bbbf0ba9
|
data/README.md
CHANGED
@@ -24,29 +24,23 @@
|
|
24
24
|
|
25
25
|
**Meilisearch Ruby** is the Meilisearch API client for Ruby developers.
|
26
26
|
|
27
|
-
**Meilisearch** is an open-source search engine. [
|
27
|
+
**Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/meilisearch)
|
28
28
|
|
29
29
|
## Table of Contents <!-- omit in toc -->
|
30
30
|
|
31
|
-
- [๐ Hacktoberfest](#-hacktoberfest)
|
32
31
|
- [๐ Documentation](#-documentation)
|
33
32
|
- [๐ง Installation](#-installation)
|
34
|
-
- [๐ Getting
|
33
|
+
- [๐ Getting started](#-getting-started)
|
35
34
|
- [๐ค Compatibility with Meilisearch](#-compatibility-with-meilisearch)
|
36
|
-
- [๐ก Learn
|
37
|
-
- [โ๏ธ
|
35
|
+
- [๐ก Learn more](#-learn-more)
|
36
|
+
- [โ๏ธ Contributing](#๏ธ-contributing)
|
38
37
|
|
39
|
-
##
|
40
|
-
|
41
|
-
Itโs Hacktoberfest 2022 @Meilisearch
|
42
|
-
|
43
|
-
[Hacktoberfest](https://hacktoberfest.com/) is a celebration of the open-source community. This year, and for the third time in a row, Meilisearch is participating in this fantastic event.
|
38
|
+
## ๐ Documentation
|
44
39
|
|
45
|
-
|
40
|
+
This readme contains all the documentation you need to start using this Meilisearch SDK.
|
46
41
|
|
47
|
-
|
42
|
+
For general information on how to use Meilisearchโsuch as our API reference, tutorials, guides, and in-depth articlesโrefer to our [main documentation website](https://docs.meilisearch.com/).
|
48
43
|
|
49
|
-
See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/).
|
50
44
|
|
51
45
|
## ๐ง Installation
|
52
46
|
|
@@ -80,7 +74,7 @@ curl -L https://install.meilisearch.com | sh
|
|
80
74
|
|
81
75
|
NB: you can also download Meilisearch from **Homebrew** or **APT** or even run it using **Docker**.
|
82
76
|
|
83
|
-
## ๐ Getting
|
77
|
+
## ๐ Getting started
|
84
78
|
|
85
79
|
#### Add documents <!-- omit in toc -->
|
86
80
|
|
@@ -206,11 +200,11 @@ JSON output:
|
|
206
200
|
|
207
201
|
## ๐ค Compatibility with Meilisearch
|
208
202
|
|
209
|
-
This package only guarantees the compatibility with the [version v0.
|
203
|
+
This package only guarantees the compatibility with the [version v0.30.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0).
|
210
204
|
|
211
|
-
## ๐ก Learn
|
205
|
+
## ๐ก Learn more
|
212
206
|
|
213
|
-
The following sections may interest you:
|
207
|
+
The following sections in our main documentation website may interest you:
|
214
208
|
|
215
209
|
- **Manipulate documents**: see the [API references](https://docs.meilisearch.com/reference/api/documents.html) or read more about [documents](https://docs.meilisearch.com/learn/core_concepts/documents.html).
|
216
210
|
- **Search**: see the [API references](https://docs.meilisearch.com/reference/api/search.html) or follow our guide on [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html).
|
@@ -219,7 +213,7 @@ The following sections may interest you:
|
|
219
213
|
|
220
214
|
๐ Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK provdes!
|
221
215
|
|
222
|
-
## โ๏ธ
|
216
|
+
## โ๏ธ Contributing
|
223
217
|
|
224
218
|
Any new contribution is more than welcome in this project!
|
225
219
|
|
data/lib/meilisearch/client.rb
CHANGED
@@ -12,6 +12,12 @@ module MeiliSearch
|
|
12
12
|
http_get('/indexes', body)
|
13
13
|
end
|
14
14
|
|
15
|
+
def swap_indexes(*options)
|
16
|
+
mapped_array = options.map { |arr| { indexes: arr } }
|
17
|
+
|
18
|
+
http_post '/swap-indexes', mapped_array
|
19
|
+
end
|
20
|
+
|
15
21
|
def indexes(options = {})
|
16
22
|
response = raw_indexes(options)
|
17
23
|
|
@@ -116,6 +122,14 @@ module MeiliSearch
|
|
116
122
|
|
117
123
|
### TASKS
|
118
124
|
|
125
|
+
def cancel_tasks(options = {})
|
126
|
+
task_endpoint.cancel_tasks(options)
|
127
|
+
end
|
128
|
+
|
129
|
+
def delete_tasks(options = {})
|
130
|
+
task_endpoint.delete_tasks(options)
|
131
|
+
end
|
132
|
+
|
119
133
|
def tasks(options = {})
|
120
134
|
task_endpoint.task_list(options)
|
121
135
|
end
|
@@ -73,11 +73,12 @@ module MeiliSearch
|
|
73
73
|
)
|
74
74
|
end
|
75
75
|
|
76
|
-
def http_delete(relative_path = '')
|
76
|
+
def http_delete(relative_path = '', query_params = nil)
|
77
77
|
send_request(
|
78
78
|
proc { |path, config| self.class.delete(path, config) },
|
79
79
|
relative_path,
|
80
80
|
config: {
|
81
|
+
query_params: query_params,
|
81
82
|
headers: remove_headers(@headers.dup, 'Content-Type'),
|
82
83
|
options: @options
|
83
84
|
}
|
data/lib/meilisearch/index.rb
CHANGED
@@ -64,10 +64,7 @@ module MeiliSearch
|
|
64
64
|
alias get_one_document document
|
65
65
|
|
66
66
|
def documents(options = {})
|
67
|
-
|
68
|
-
body = body.transform_values { |v| v.respond_to?(:join) ? v.join(',') : v }
|
69
|
-
|
70
|
-
http_get "/indexes/#{@uid}/documents", body
|
67
|
+
http_get "/indexes/#{@uid}/documents", Utils.parse_query(options, [:limit, :offset, :fields])
|
71
68
|
end
|
72
69
|
alias get_documents documents
|
73
70
|
|
@@ -194,7 +191,8 @@ module MeiliSearch
|
|
194
191
|
parsed_options = Utils.transform_attributes({ q: query.to_s }.merge(options.compact))
|
195
192
|
|
196
193
|
response = http_post "/indexes/#{@uid}/search", parsed_options
|
197
|
-
|
194
|
+
|
195
|
+
response['nbHits'] ||= response['estimatedTotalHits'] unless response.key?('totalPages')
|
198
196
|
|
199
197
|
response
|
200
198
|
end
|
data/lib/meilisearch/task.rb
CHANGED
@@ -5,13 +5,15 @@ require 'timeout'
|
|
5
5
|
|
6
6
|
module MeiliSearch
|
7
7
|
class Task < HTTPRequest
|
8
|
-
ALLOWED_PARAMS = [
|
8
|
+
ALLOWED_PARAMS = [
|
9
|
+
:limit, :from, :index_uids, :types, :statuses, :uids, :canceled_by,
|
10
|
+
:before_enqueued_at, :after_enqueued_at, :before_started_at, :after_started_at,
|
11
|
+
:before_finished_at, :after_finished_at
|
12
|
+
].freeze
|
13
|
+
ALLOWED_CANCELATION_PARAMS = (ALLOWED_PARAMS - [:limit, :from]).freeze
|
9
14
|
|
10
15
|
def task_list(options = {})
|
11
|
-
|
12
|
-
body = body.transform_values { |v| v.respond_to?(:join) ? v.join(',') : v }
|
13
|
-
|
14
|
-
http_get '/tasks/', body
|
16
|
+
http_get '/tasks/', Utils.parse_query(options, ALLOWED_PARAMS)
|
15
17
|
end
|
16
18
|
|
17
19
|
def task(task_uid)
|
@@ -19,13 +21,21 @@ module MeiliSearch
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def index_tasks(index_uid)
|
22
|
-
http_get '/tasks', {
|
24
|
+
http_get '/tasks', { indexUids: [index_uid].flatten.join(',') }
|
23
25
|
end
|
24
26
|
|
25
27
|
def index_task(task_uid)
|
26
28
|
http_get "/tasks/#{task_uid}"
|
27
29
|
end
|
28
30
|
|
31
|
+
def cancel_tasks(options)
|
32
|
+
http_post '/tasks/cancel', nil, Utils.parse_query(options, ALLOWED_CANCELATION_PARAMS)
|
33
|
+
end
|
34
|
+
|
35
|
+
def delete_tasks(options)
|
36
|
+
http_delete '/tasks', Utils.parse_query(options, ALLOWED_CANCELATION_PARAMS)
|
37
|
+
end
|
38
|
+
|
29
39
|
def wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50)
|
30
40
|
Timeout.timeout(timeout_in_ms.to_f / 1000) do
|
31
41
|
loop do
|
data/lib/meilisearch/utils.rb
CHANGED
@@ -23,6 +23,16 @@ module MeiliSearch
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.parse_query(original_options, allowed_params = [])
|
27
|
+
only_allowed_params = original_options.transform_keys(&:to_sym).slice(*allowed_params)
|
28
|
+
|
29
|
+
Utils.transform_attributes(only_allowed_params).then do |body|
|
30
|
+
body.transform_values do |v|
|
31
|
+
v.respond_to?(:join) ? v.join(',') : v.to_s
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
26
36
|
private_class_method :parse
|
27
37
|
end
|
28
38
|
end
|
data/lib/meilisearch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meilisearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|