meilisearch 0.25.0 → 0.26.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: 6503fb7f801990fd58fee344cdd3ea25edc549ddf2423b59c2ca84b2bcd11390
4
- data.tar.gz: dfbb61ed72936cf705cddbdf76601ea94250dbf0cd95142e54d6a4f82771307d
3
+ metadata.gz: e182244659129f40ceff661d8e117af391a68aa1cf5fed79f198fc715863ba4e
4
+ data.tar.gz: 17f9fd0b3b529829f1bd3d4d39cb3444532ec2cc14b0aebaeac00bae6f217d9b
5
5
  SHA512:
6
- metadata.gz: 5b0820f6b28e681410a4dde5538d8fb87dddba5f28d40ff5807d54c94e7886f3778b95e0b6c4658dabb6bd55c5698b27ca18fc051d00b60f138aeb3160e47260
7
- data.tar.gz: aa7f20470f2014ae5a9526768c9418fd91d08478553254eb20e9600fbaf004042f7d585a5d3865c78c5db5daa024d1a583f048fef9b1428c1b73f09268327dc9
6
+ metadata.gz: 6aefe0097ef3f3c1785f1498ade5508ac77fca3e5aef025931d7ec34e12462419721cd2b7a1ee9d8c5037a36fa0dedd3aeabb35b473a400e05b9880401495149
7
+ data.tar.gz: 5b9949303254ca87e378904dadbbf0f7fc77a113cbda175dfb7bb950b674ed09742d411c0fb45cbc3a5626c6c16ebd1549e402b76504016b1e9567e28ba4e084
data/README.md CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  **Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/meilisearch)
32
32
 
33
- ## Table of Contents <!-- omit in toc -->
33
+ ## Table of Contents <!-- omit in TOC -->
34
34
 
35
35
  - [📖 Documentation](#-documentation)
36
36
  - [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
@@ -207,6 +207,82 @@ JSON output:
207
207
  }
208
208
  ```
209
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
+
210
286
  ## 🤖 Compatibility with Meilisearch
211
287
 
212
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.
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MeiliSearch
4
- class ApiError < StandardError
4
+ class Error < StandardError
5
+ end
6
+
7
+ class ApiError < Error
5
8
  # :http_code # e.g. 400, 404...
6
9
  # :http_message # e.g. Bad Request, Not Found...
7
10
  # :http_body # The response body received from the MeiliSearch API
@@ -45,7 +48,7 @@ module MeiliSearch
45
48
  end
46
49
  end
47
50
 
48
- class CommunicationError < StandardError
51
+ class CommunicationError < Error
49
52
  attr_reader :message
50
53
 
51
54
  def initialize(message)
@@ -54,7 +57,7 @@ module MeiliSearch
54
57
  end
55
58
  end
56
59
 
57
- class TimeoutError < StandardError
60
+ class TimeoutError < Error
58
61
  attr_reader :message
59
62
 
60
63
  def initialize(message = nil)
@@ -64,8 +67,8 @@ module MeiliSearch
64
67
  end
65
68
 
66
69
  module TenantToken
67
- class ExpireOrInvalidSignature < StandardError; end
68
- class InvalidApiKey < StandardError; end
69
- class InvalidSearchRules < StandardError; end
70
+ class ExpireOrInvalidSignature < MeiliSearch::Error; end
71
+ class InvalidApiKey < MeiliSearch::Error; end
72
+ class InvalidSearchRules < MeiliSearch::Error; end
70
73
  end
71
74
  end
@@ -220,6 +220,9 @@ 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
227
  attributes = { q: query.to_s }.merge(options.compact)
225
228
 
@@ -231,6 +234,15 @@ module MeiliSearch
231
234
  response
232
235
  end
233
236
 
237
+ ### FACET SEARCH
238
+
239
+ def facet_search(name, query = '', **options)
240
+ options.merge!(facet_name: name, facet_query: query)
241
+ options = Utils.transform_attributes(options)
242
+
243
+ http_post("/indexes/#{@uid}/facet-search", options)
244
+ end
245
+
234
246
  ### TASKS
235
247
 
236
248
  def task_endpoint
@@ -458,5 +470,49 @@ module MeiliSearch
458
470
  def reset_faceting
459
471
  http_delete("/indexes/#{@uid}/settings/faceting")
460
472
  end
473
+
474
+ ### SETTINGS - DICTIONARY
475
+
476
+ def dictionary
477
+ http_get("/indexes/#{@uid}/settings/dictionary")
478
+ end
479
+
480
+ def update_dictionary(dictionary_attributes)
481
+ attributes = Utils.transform_attributes(dictionary_attributes)
482
+ http_put("/indexes/#{@uid}/settings/dictionary", attributes)
483
+ end
484
+
485
+ def reset_dictionary
486
+ http_delete("/indexes/#{@uid}/settings/dictionary")
487
+ end
488
+ ### SETTINGS - SEPARATOR TOKENS
489
+
490
+ def separator_tokens
491
+ http_get("/indexes/#{@uid}/settings/separator-tokens")
492
+ end
493
+
494
+ def update_separator_tokens(separator_tokens_attributes)
495
+ attributes = Utils.transform_attributes(separator_tokens_attributes)
496
+ http_put("/indexes/#{@uid}/settings/separator-tokens", attributes)
497
+ end
498
+
499
+ def reset_separator_tokens
500
+ http_delete("/indexes/#{@uid}/settings/separator-tokens")
501
+ end
502
+
503
+ ### SETTINGS - NON SEPARATOR TOKENS
504
+
505
+ def non_separator_tokens
506
+ http_get("/indexes/#{@uid}/settings/non-separator-tokens")
507
+ end
508
+
509
+ def update_non_separator_tokens(non_separator_tokens_attributes)
510
+ attributes = Utils.transform_attributes(non_separator_tokens_attributes)
511
+ http_put("/indexes/#{@uid}/settings/non-separator-tokens", attributes)
512
+ end
513
+
514
+ def reset_non_separator_tokens
515
+ http_delete("/indexes/#{@uid}/settings/non-separator-tokens")
516
+ end
461
517
  end
462
518
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MeiliSearch
4
- VERSION = '0.25.0'
4
+ VERSION = '0.26.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.25.0
4
+ version: 0.26.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-08-15 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty