meilisearch-rails 0.8.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/meilisearch/rails/version.rb +1 -1
- data/lib/meilisearch-rails.rb +16 -9
- data/meilisearch-rails.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcc344e4fd67e6c871a2bd17a90f9f2ddfd621b455ab25ea4925bd97c797db97
|
4
|
+
data.tar.gz: 6849bd317a751754beab3642c29405d6022da03cb1266fd0b77c6c12e57f5765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a575ccd86876ac883955ec6f660635da5f9927802253d011131e7c16a3e681bd9942740785d16c117cd01e2e919ca036ab7439f84c8d6da609df95dcc3e95afe
|
7
|
+
data.tar.gz: a03067f0ab9e8acfad6ace43421c80e332f118a16b15f8642537e0cc4749aaa04caf7cd33a19064560d0864614cd56807b933b1a06a56f6ceb9a070d4468b2d5
|
data/README.md
CHANGED
@@ -62,7 +62,7 @@ To learn more about Meilisearch, check out our [Documentation](https://docs.meil
|
|
62
62
|
|
63
63
|
## 🤖 Compatibility with Meilisearch
|
64
64
|
|
65
|
-
This package
|
65
|
+
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-rails/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.
|
66
66
|
|
67
67
|
## 🔧 Installation <!-- omit in toc -->
|
68
68
|
|
@@ -185,6 +185,7 @@ class Book < ApplicationRecord
|
|
185
185
|
attributes_to_highlight ['*']
|
186
186
|
attributes_to_crop [:description]
|
187
187
|
crop_length 10
|
188
|
+
faceting max_values_per_facet: 2000
|
188
189
|
pagination max_total_hits: 1000
|
189
190
|
end
|
190
191
|
end
|
data/lib/meilisearch-rails.rb
CHANGED
@@ -60,9 +60,11 @@ module MeiliSearch
|
|
60
60
|
attributesToCrop
|
61
61
|
cropLength
|
62
62
|
pagination
|
63
|
+
faceting
|
64
|
+
typoTolerance
|
63
65
|
].freeze
|
64
66
|
|
65
|
-
CAMELIZE_OPTIONS = %i[pagination].freeze
|
67
|
+
CAMELIZE_OPTIONS = %i[pagination faceting typoTolerance].freeze
|
66
68
|
|
67
69
|
OPTIONS.each do |option|
|
68
70
|
define_method option do |value|
|
@@ -198,6 +200,10 @@ module MeiliSearch
|
|
198
200
|
instance_variable_get("@#{name}")
|
199
201
|
end
|
200
202
|
|
203
|
+
def camelize_keys(hash)
|
204
|
+
hash.transform_keys { |key| key.to_s.camelize(:lower) }
|
205
|
+
end
|
206
|
+
|
201
207
|
def to_settings
|
202
208
|
settings = {}
|
203
209
|
OPTIONS.each do |k|
|
@@ -205,7 +211,12 @@ module MeiliSearch
|
|
205
211
|
next if v.nil?
|
206
212
|
|
207
213
|
settings[k] = if CAMELIZE_OPTIONS.include?(k) && v.is_a?(Hash)
|
208
|
-
v
|
214
|
+
v = camelize_keys(v)
|
215
|
+
|
216
|
+
# camelize keys of nested hashes
|
217
|
+
v.each do |key, value|
|
218
|
+
v[key] = camelize_keys(value) if value.is_a?(Hash)
|
219
|
+
end
|
209
220
|
else
|
210
221
|
v
|
211
222
|
end
|
@@ -587,13 +598,6 @@ module MeiliSearch
|
|
587
598
|
end
|
588
599
|
|
589
600
|
module AdditionalMethods
|
590
|
-
def self.extended(base)
|
591
|
-
class << base
|
592
|
-
alias_method :raw_answer, :ms_raw_answer unless method_defined? :raw_answer
|
593
|
-
alias_method :facets_distribution, :ms_facets_distribution unless method_defined? :facets_distribution
|
594
|
-
end
|
595
|
-
end
|
596
|
-
|
597
601
|
def ms_raw_answer
|
598
602
|
@ms_json
|
599
603
|
end
|
@@ -602,6 +606,9 @@ module MeiliSearch
|
|
602
606
|
@ms_json['facetDistribution']
|
603
607
|
end
|
604
608
|
|
609
|
+
alias raw_answer ms_raw_answer unless method_defined? :raw_answer
|
610
|
+
alias facets_distribution ms_facets_distribution unless method_defined? :facets_distribution
|
611
|
+
|
605
612
|
private
|
606
613
|
|
607
614
|
def ms_init_raw_answer(json)
|
data/meilisearch-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meilisearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.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-
|
11
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: meilisearch
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.23.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.23.0
|
27
27
|
description: Meilisearch integration for Ruby on Rails. See https://github.com/meilisearch/meilisearch
|
28
28
|
email: bonjour@meilisearch.com
|
29
29
|
executables: []
|