meilisearch 0.24.0 → 0.25.1

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: a6fbd8b345ade69adfd322c7cf10e0e1acca19ecdbf84eb0ef7f04b8ce2ec810
4
- data.tar.gz: 88c9635e0310e89f3a793a7ff39741e49c88f1bcf7f9916c2f2873642dd329d0
3
+ metadata.gz: 64423a34ad9823417a67cf271103db76b41c3895470dbd13a1c90d986792d439
4
+ data.tar.gz: 1bc5ba4774f7704cc6aefed0458dab6de7f4a4c0b4e45c9bb762b4843fc7c5ed
5
5
  SHA512:
6
- metadata.gz: 9d674d11207d8f829d132996f01a2f6ed59da3f79d004c518df6d1ec73c8c7f966b5179da373a90d00073dc813a2cd3a74cb46efb6212b5dc3958fe2b7c27118
7
- data.tar.gz: d5912112b1a69edafff5825d63d488d6d0ffc7106c7ec807d992f1eef9e7c0f6a635b54fe3b716afe6d372fad95cce10bcac4231ba233ec07a839e7ebc8e14f0
6
+ metadata.gz: 37800a57fffe10aa250adf14af4b34855af7281c4adc7b4c0b62b573ad87ff365095493be04b56c2451de79aac20533625738bee98f70c5c124302bfe6172096
7
+ data.tar.gz: b15bb586f86ba17e6b7546b246380458c1573c3c2c038e00610e2e83b1ad08dbf06293cdb1180cf309ee4317f0441f0df5edc08273d3f1ffe3b363e8acc09fe1
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://docs.meilisearch.com/faq">FAQ</a>
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://docs.meilisearch.com/).
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://docs.meilisearch.com/learn/getting_started/quick_start.html#setup-and-installation).
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://docs.meilisearch.com/reference/api/tasks.html#get-tasks).
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://docs.meilisearch.com/reference/api/search.html#search-parameters) section of the documentation.
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://docs.meilisearch.com/reference/api/tasks.html#get-tasks)).
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
 
@@ -198,6 +207,82 @@ JSON output:
198
207
  }
199
208
  ```
200
209
 
210
+ #### Display ranking details at search
211
+
212
+ JSON output:
213
+
214
+ ```json
215
+ {
216
+ "hits": [
217
+ {
218
+ "id": 15359,
219
+ "title": "Wonder Woman",
220
+ "_rankingScoreDetails": {
221
+ "words": {
222
+ "order": 0,
223
+ "matchingWords": 2,
224
+ "maxMatchingWords": 2,
225
+ "score": 1.0
226
+ },
227
+ "typo": {
228
+ "order": 1,
229
+ "typoCount": 0,
230
+ "maxTypoCount": 2,
231
+ "score": 1.0
232
+ },
233
+ "proximity": {
234
+ "order": 2,
235
+ "score": 1.0
236
+ },
237
+ "attribute": {
238
+ "order": 3,
239
+ "attributeRankingOrderScore": 0.8181818181818182,
240
+ "queryWordDistanceScore": 1.0,
241
+ "score": 0.8181818181818182
242
+ },
243
+ "exactness": {
244
+ "order": 4,
245
+ "matchType": "exactMatch",
246
+ "score": 1.0
247
+ }
248
+ }
249
+ }
250
+ ]
251
+ }
252
+ ```
253
+
254
+ You can enable it by querying PATCH /experimental-features with { "scoreDetails": true }
255
+
256
+ This feature is only available with Meilisearch v1.3 and newer (optional).
257
+
258
+ #### Custom Search With attributes on at search time <!-- omit in toc -->
259
+
260
+ [Customize attributes to search on at search time](https://www.meilisearch.com/docs/reference/api/search#customize-attributes-to-search-on-at-search-time).
261
+
262
+ you can perform the search :
263
+
264
+ ```ruby
265
+ index.search('wonder', { attributes_to_search_on: ['genres'] })
266
+ ```
267
+
268
+
269
+ JSON output:
270
+
271
+ ```json
272
+ {
273
+ "hits":[],
274
+ "query":"wonder",
275
+ "processingTimeMs":0,
276
+ "limit":20,
277
+ "offset":0,
278
+ "estimatedTotalHits":0,
279
+ "nbHits":0
280
+ }
281
+ ```
282
+
283
+ This feature is only available with Meilisearch v1.3 and newer (optional).
284
+
285
+
201
286
  ## 🤖 Compatibility with Meilisearch
202
287
 
203
288
  This package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-ruby/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.
@@ -206,12 +291,12 @@ This package guarantees compatibility with [version v1.x of Meilisearch](https:/
206
291
 
207
292
  The following sections in our main documentation website may interest you:
208
293
 
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).
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/api/search.html#search-parameters).
211
- - **Manage the indexes**: see the [API references](https://docs.meilisearch.com/reference/api/indexes.html) or read more about [indexes](https://docs.meilisearch.com/learn/core_concepts/indexes.html).
212
- - **Configure the index settings**: see the [API references](https://docs.meilisearch.com/reference/api/settings.html) or follow our guide on [settings parameters](https://docs.meilisearch.com/reference/features/settings.html).
294
+ - **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).
295
+ - **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).
296
+ - **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).
297
+ - **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
298
 
214
- 📖 Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK provdes!
299
+ 📖 Also, check out the [Wiki](https://github.com/meilisearch/meilisearch-ruby/wiki) of this repository to know what this SDK provides!
215
300
 
216
301
  ## ⚙️ Contributing
217
302
 
@@ -31,7 +31,7 @@ module MeiliSearch
31
31
 
32
32
  # Usage:
33
33
  # client.create_index('indexUID')
34
- # client.create_index('indexUID', primaryKey: 'id')
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
 
@@ -220,9 +220,13 @@ module MeiliSearch
220
220
 
221
221
  ### SEARCH
222
222
 
223
+ # options: A Hash
224
+ # show_ranking_score - To see the ranking scores for returned documents
225
+ # attributes_to_search_on - Customize attributes to search on at search time.
223
226
  def search(query, options = {})
224
- parsed_options = Utils.transform_attributes({ q: query.to_s }.merge(options.compact))
227
+ attributes = { q: query.to_s }.merge(options.compact)
225
228
 
229
+ parsed_options = Utils.transform_attributes(attributes)
226
230
  response = http_post "/indexes/#{@uid}/search", parsed_options
227
231
 
228
232
  response['nbHits'] ||= response['estimatedTotalHits'] unless response.key?('totalPages')
@@ -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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MeiliSearch
4
- VERSION = '0.24.0'
4
+ VERSION = '0.25.1'
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.24.0
4
+ version: 0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meili
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty