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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a40fa643cb41246f5e77e635458aa3e516b76806e63f10e41d49eae41a2fd357
4
- data.tar.gz: deb1618089a993f0f34e79b836ebc650db402253939c95ad1c15cb222d15a33d
3
+ metadata.gz: 012ab51bfcb13141e38b43587639b9f0c87c15b390025008b19edb78d3c6f8cd
4
+ data.tar.gz: 101f00e8a3507911aa17481466ffcffbd1c586c455eb8a15eac85ccf4d8e0b8f
5
5
  SHA512:
6
- metadata.gz: a3e5ff462a29b80b1b8a36060301d42064563a9211109465bbc58b004bc7c5125c851ef9e22afb5c36c9c9197e1fa09ff30a3de8e90a57a9e9edfeb85a58723d
7
- data.tar.gz: 287b3057c280021c31ff7e40ef91f8fc4c8733f52ae728ecc421b0b5ebfb0781ea02591804ef052da89cf37c006d6c0a03b20afc65b249ad4264ad9c59b750a3
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. [Discover what Meilisearch is!](https://github.com/meilisearch/meilisearch)
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 Started](#-getting-started)
33
+ - [๐Ÿš€ Getting started](#-getting-started)
35
34
  - [๐Ÿค– Compatibility with Meilisearch](#-compatibility-with-meilisearch)
36
- - [๐Ÿ’ก Learn More](#-learn-more)
37
- - [โš™๏ธ Development Workflow and Contributing](#๏ธ-development-workflow-and-contributing)
35
+ - [๐Ÿ’ก Learn more](#-learn-more)
36
+ - [โš™๏ธ Contributing](#๏ธ-contributing)
38
37
 
39
- ## ๐ŸŽƒ Hacktoberfest
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
- Youโ€™d like to contribute? Donโ€™t hesitate to check out our [contributing guidelines](./CONTRIBUTING.md).
40
+ This readme contains all the documentation you need to start using this Meilisearch SDK.
46
41
 
47
- ## ๐Ÿ“– Documentation
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 Started
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.29.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.29.0).
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 More
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
- ## โš™๏ธ Development Workflow and Contributing
216
+ ## โš™๏ธ Contributing
223
217
 
224
218
  Any new contribution is more than welcome in this project!
225
219
 
@@ -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
  }
@@ -64,10 +64,7 @@ module MeiliSearch
64
64
  alias get_one_document document
65
65
 
66
66
  def documents(options = {})
67
- body = Utils.transform_attributes(options.transform_keys(&:to_sym).slice(:limit, :offset, :fields))
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
- response['nbHits'] ||= response['estimatedTotalHits']
194
+
195
+ response['nbHits'] ||= response['estimatedTotalHits'] unless response.key?('totalPages')
198
196
 
199
197
  response
200
198
  end
@@ -5,13 +5,15 @@ require 'timeout'
5
5
 
6
6
  module MeiliSearch
7
7
  class Task < HTTPRequest
8
- ALLOWED_PARAMS = [:limit, :from, :index_uid, :type, :status].freeze
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
- body = Utils.transform_attributes(options.transform_keys(&:to_sym).slice(*ALLOWED_PARAMS))
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', { indexUid: [index_uid].flatten.join(',') }
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
@@ -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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MeiliSearch
4
- VERSION = '0.20.0'
4
+ VERSION = '0.21.0'
5
5
 
6
6
  def self.qualified_version
7
7
  "Meilisearch Ruby (v#{VERSION})"
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.20.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-10-03 00:00:00.000000000 Z
11
+ date: 2022-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty