meilisearch 0.19.2 โ†’ 0.21.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
  SHA256:
3
- metadata.gz: 67fd01c01f58eb04e3d5e8d33c12f66a6ed9601d743444d8ade60f93cd05e322
4
- data.tar.gz: aa37afae83757583053e1fdd821ef8e87f0e518edbfe1c52c2abba3d27610b4a
3
+ metadata.gz: 012ab51bfcb13141e38b43587639b9f0c87c15b390025008b19edb78d3c6f8cd
4
+ data.tar.gz: 101f00e8a3507911aa17481466ffcffbd1c586c455eb8a15eac85ccf4d8e0b8f
5
5
  SHA512:
6
- metadata.gz: 04b69743166d96c14954eb5a06ad77f1d8edd9b7e6884f8fc19f2235ee88897adc570cb68cc39357bedb993eaad0312979f746bf3773bbf54a130bb347b9fa25
7
- data.tar.gz: 242457a2a1aacebcc754a7380976e289f9691bbf8c2d08a3395f70e2608ae4516286329316c28de0ec2fd342499d93b6384f1f14c04e98c21672f402a79de4c5
6
+ metadata.gz: 87837129a31b9e962957f148525877ffddcdfb4e4e2e36b43cfdeb5f66e0f0e1e95ee8cef3650433156f59c9a70c6d6dccff8110f333214cd9983a996895cd0e
7
+ data.tar.gz: c3960dc5623ec4629324b113210596744a482c5411046b9e1ea62c5906f2aae600c2c8bdf9aceb3306b6b2a97dce5eddfc4844307feb96a74e4d74b5bbbf0ba9
data/README.md CHANGED
@@ -24,20 +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
31
  - [๐Ÿ“– Documentation](#-documentation)
32
32
  - [๐Ÿ”ง Installation](#-installation)
33
- - [๐Ÿš€ Getting Started](#-getting-started)
33
+ - [๐Ÿš€ Getting started](#-getting-started)
34
34
  - [๐Ÿค– Compatibility with Meilisearch](#-compatibility-with-meilisearch)
35
- - [๐Ÿ’ก Learn More](#-learn-more)
36
- - [โš™๏ธ Development Workflow and Contributing](#๏ธ-development-workflow-and-contributing)
35
+ - [๐Ÿ’ก Learn more](#-learn-more)
36
+ - [โš™๏ธ Contributing](#๏ธ-contributing)
37
37
 
38
38
  ## ๐Ÿ“– Documentation
39
39
 
40
- See our [Documentation](https://docs.meilisearch.com/learn/tutorials/getting_started.html) or our [API References](https://docs.meilisearch.com/reference/api/).
40
+ This readme contains all the documentation you need to start using this Meilisearch SDK.
41
+
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/).
43
+
41
44
 
42
45
  ## ๐Ÿ”ง Installation
43
46
 
@@ -71,7 +74,7 @@ curl -L https://install.meilisearch.com | sh
71
74
 
72
75
  NB: you can also download Meilisearch from **Homebrew** or **APT** or even run it using **Docker**.
73
76
 
74
- ## ๐Ÿš€ Getting Started
77
+ ## ๐Ÿš€ Getting started
75
78
 
76
79
  #### Add documents <!-- omit in toc -->
77
80
 
@@ -197,11 +200,11 @@ JSON output:
197
200
 
198
201
  ## ๐Ÿค– Compatibility with Meilisearch
199
202
 
200
- This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.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).
201
204
 
202
- ## ๐Ÿ’ก Learn More
205
+ ## ๐Ÿ’ก Learn more
203
206
 
204
- The following sections may interest you:
207
+ The following sections in our main documentation website may interest you:
205
208
 
206
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).
207
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).
@@ -210,7 +213,7 @@ The following sections may interest you:
210
213
 
211
214
  ๐Ÿ“– Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK provdes!
212
215
 
213
- ## โš™๏ธ Development Workflow and Contributing
216
+ ## โš™๏ธ Contributing
214
217
 
215
218
  Any new contribution is more than welcome in this project!
216
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.19.2'
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.19.2
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-08-01 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