meilisearch 0.24.0 → 0.25.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 +20 -11
- data/lib/meilisearch/client.rb +1 -1
- data/lib/meilisearch/index.rb +2 -1
- data/lib/meilisearch/utils.rb +16 -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: 6503fb7f801990fd58fee344cdd3ea25edc549ddf2423b59c2ca84b2bcd11390
|
4
|
+
data.tar.gz: dfbb61ed72936cf705cddbdf76601ea94250dbf0cd95142e54d6a4f82771307d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b0820f6b28e681410a4dde5538d8fb87dddba5f28d40ff5807d54c94e7886f3778b95e0b6c4658dabb6bd55c5698b27ca18fc051d00b60f138aeb3160e47260
|
7
|
+
data.tar.gz: aa7f20470f2014ae5a9526768c9418fd91d08478553254eb20e9600fbaf004042f7d585a5d3865c78c5db5daa024d1a583f048fef9b1428c1b73f09268327dc9
|
data/README.md
CHANGED
@@ -6,16 +6,20 @@
|
|
6
6
|
|
7
7
|
<h4 align="center">
|
8
8
|
<a href="https://github.com/meilisearch/meilisearch">Meilisearch</a> |
|
9
|
+
<a href="https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-ruby">Meilisearch Cloud</a> |
|
9
10
|
<a href="https://docs.meilisearch.com">Documentation</a> |
|
10
11
|
<a href="https://discord.meilisearch.com">Discord</a> |
|
11
12
|
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
|
12
13
|
<a href="https://www.meilisearch.com">Website</a> |
|
13
|
-
<a href="https://
|
14
|
+
<a href="https://www.meilisearch.com/docs/faq">FAQ</a>
|
14
15
|
</h4>
|
15
16
|
|
16
17
|
<p align="center">
|
17
18
|
<a href="https://badge.fury.io/rb/meilisearch"><img src="https://badge.fury.io/rb/meilisearch.svg" alt="Latest Stable Version"></a>
|
18
19
|
<a href="https://github.com/meilisearch/meilisearch-ruby/actions"><img src="https://github.com/meilisearch/meilisearch-ruby/workflows/Tests/badge.svg" alt="Test"></a>
|
20
|
+
<a href="https://app.codecov.io/gh/meilisearch/meilisearch-ruby/tree/main" >
|
21
|
+
<img src="https://codecov.io/gh/meilisearch/meilisearch-ruby/branch/main/graph/badge.svg?token=9J7LRP11IR"/>
|
22
|
+
</a>
|
19
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>
|
20
24
|
<a href="https://ms-bors.herokuapp.com/repositories/6"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
|
21
25
|
</p>
|
@@ -29,6 +33,7 @@
|
|
29
33
|
## Table of Contents <!-- omit in toc -->
|
30
34
|
|
31
35
|
- [📖 Documentation](#-documentation)
|
36
|
+
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
|
32
37
|
- [🔧 Installation](#-installation)
|
33
38
|
- [🚀 Getting started](#-getting-started)
|
34
39
|
- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)
|
@@ -39,9 +44,13 @@
|
|
39
44
|
|
40
45
|
This readme contains all the documentation you need to start using this Meilisearch SDK.
|
41
46
|
|
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://
|
47
|
+
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://www.meilisearch.com/docs/).
|
43
48
|
|
44
49
|
|
50
|
+
## ⚡ Supercharge your Meilisearch experience
|
51
|
+
|
52
|
+
Say goodbye to server deployment and manual updates with [Meilisearch Cloud](https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-ruby). Get started with a 14-day free trial! No credit card required.
|
53
|
+
|
45
54
|
## 🔧 Installation
|
46
55
|
|
47
56
|
This package requires Ruby version 2.6.0 or later.
|
@@ -60,7 +69,7 @@ gem 'meilisearch'
|
|
60
69
|
|
61
70
|
### Run Meilisearch <!-- omit in toc -->
|
62
71
|
|
63
|
-
There are many easy ways to [download and run a Meilisearch instance](https://
|
72
|
+
There are many easy ways to [download and run a Meilisearch instance](https://www.meilisearch.com/docs/learn/getting_started/quick_start#setup-and-installation).
|
64
73
|
|
65
74
|
For example, using the `curl` command in your [Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/what-is-a-terminal/):
|
66
75
|
|
@@ -98,7 +107,7 @@ documents = [
|
|
98
107
|
index.add_documents(documents) # => { "uid": 0 }
|
99
108
|
```
|
100
109
|
|
101
|
-
With the `uid`, you can check the status (`enqueued`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://
|
110
|
+
With the `uid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task](https://www.meilisearch.com/docs/reference/api/tasks#get-tasks).
|
102
111
|
|
103
112
|
💡 To customize the `Client`, for example, increasing the default timeout, please check out [this section](https://github.com/meilisearch/meilisearch-ruby/wiki/Client-Options) of the Wiki.
|
104
113
|
|
@@ -125,7 +134,7 @@ Output:
|
|
125
134
|
|
126
135
|
#### Custom search <!-- omit in toc -->
|
127
136
|
|
128
|
-
All the supported options are described in the [search parameters](https://
|
137
|
+
All the supported options are described in the [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters) section of the documentation.
|
129
138
|
|
130
139
|
```ruby
|
131
140
|
index.search(
|
@@ -168,7 +177,7 @@ index.update_filterable_attributes([
|
|
168
177
|
|
169
178
|
You only need to perform this operation once.
|
170
179
|
|
171
|
-
Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](https://
|
180
|
+
Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [tasks](https://www.meilisearch.com/docs/reference/api/tasks#get-tasks)).
|
172
181
|
|
173
182
|
Then, you can perform the search:
|
174
183
|
|
@@ -206,12 +215,12 @@ This package guarantees compatibility with [version v1.x of Meilisearch](https:/
|
|
206
215
|
|
207
216
|
The following sections in our main documentation website may interest you:
|
208
217
|
|
209
|
-
- **Manipulate documents**: see the [API references](https://
|
210
|
-
- **Search**: see the [API references](https://
|
211
|
-
- **Manage the indexes**: see the [API references](https://
|
212
|
-
- **Configure the index settings**: see the [API references](https://
|
218
|
+
- **Manipulate documents**: see the [API references](https://www.meilisearch.com/docs/reference/api/documents) or read more about [documents](https://www.meilisearch.com/docs/learn/core_concepts/documents).
|
219
|
+
- **Search**: see the [API references](https://www.meilisearch.com/docs/reference/api/search) or follow our guide on [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters).
|
220
|
+
- **Manage the indexes**: see the [API references](https://www.meilisearch.com/docs/reference/api/indexes) or read more about [indexes](https://www.meilisearch.com/docs/learn/core_concepts/indexes).
|
221
|
+
- **Configure the index settings**: see the [API references](https://www.meilisearch.com/docs/reference/api/settings) or follow our guide on [settings parameters](https://www.meilisearch.com/docs/reference/api/settings).
|
213
222
|
|
214
|
-
📖 Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK
|
223
|
+
📖 Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK provides!
|
215
224
|
|
216
225
|
## ⚙️ Contributing
|
217
226
|
|
data/lib/meilisearch/client.rb
CHANGED
@@ -31,7 +31,7 @@ module MeiliSearch
|
|
31
31
|
|
32
32
|
# Usage:
|
33
33
|
# client.create_index('indexUID')
|
34
|
-
# client.create_index('indexUID',
|
34
|
+
# client.create_index('indexUID', primary_key: 'id')
|
35
35
|
def create_index(index_uid, options = {})
|
36
36
|
body = Utils.transform_attributes(options.merge(uid: index_uid))
|
37
37
|
|
data/lib/meilisearch/index.rb
CHANGED
@@ -221,8 +221,9 @@ module MeiliSearch
|
|
221
221
|
### SEARCH
|
222
222
|
|
223
223
|
def search(query, options = {})
|
224
|
-
|
224
|
+
attributes = { q: query.to_s }.merge(options.compact)
|
225
225
|
|
226
|
+
parsed_options = Utils.transform_attributes(attributes)
|
226
227
|
response = http_post "/indexes/#{@uid}/search", parsed_options
|
227
228
|
|
228
229
|
response['nbHits'] ||= response['estimatedTotalHits'] unless response.key?('totalPages')
|
data/lib/meilisearch/utils.rb
CHANGED
@@ -9,6 +9,7 @@ module MeiliSearch
|
|
9
9
|
when Array
|
10
10
|
body.map { |item| transform_attributes(item) }
|
11
11
|
when Hash
|
12
|
+
warn_on_non_conforming_attribute_names(body)
|
12
13
|
parse(body)
|
13
14
|
else
|
14
15
|
body
|
@@ -52,6 +53,21 @@ module MeiliSearch
|
|
52
53
|
raise e.class, message_builder(e.message, method_name)
|
53
54
|
end
|
54
55
|
|
56
|
+
def self.warn_on_non_conforming_attribute_names(body)
|
57
|
+
return if body.nil?
|
58
|
+
|
59
|
+
non_snake_case = body.keys.grep_v(/^[a-z0-9_]+$/)
|
60
|
+
return if non_snake_case.empty?
|
61
|
+
|
62
|
+
message = <<~MSG
|
63
|
+
Attributes will be expected to be snake_case in future versions of Meilisearch Ruby.
|
64
|
+
|
65
|
+
Non-conforming attributes: #{non_snake_case.join(', ')}
|
66
|
+
MSG
|
67
|
+
|
68
|
+
warn(message)
|
69
|
+
end
|
70
|
+
|
55
71
|
private_class_method :parse, :message_builder
|
56
72
|
end
|
57
73
|
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.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|