meilisearch-rails 0.13.1 → 0.14.1
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 +4 -4
- data/.rspec +1 -0
- data/README.md +1 -1
- data/lib/meilisearch/rails/ms_clean_up_job.rb +1 -1
- data/lib/meilisearch/rails/version.rb +1 -1
- data/lib/meilisearch-rails.rb +20 -19
- data/meilisearch-rails.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24559c8e70fcdaef7392de52e689ed37427c1e87a8981e693f123c8b7348d75a
|
4
|
+
data.tar.gz: 415f7739643c82925fa54dc3b6a3d2dcf182d66969010fc84d3cf64a9444fc37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce2015617e15a63f5d9fa39686b92272e83fb70c8ae66144847aa712ac51341ff1f56073006936fb568996105ee45142cedccfb5123befd79a033312efd37173
|
7
|
+
data.tar.gz: a906f6cc4bb10f6de8c38e19ab4225ffc7a1009517dedf0849972af3a6df50d6518371e66660477a8eb92291266bfea23e5ae135ebc3ca6f611e9e17828a4429
|
data/.rspec
CHANGED
data/README.md
CHANGED
@@ -76,7 +76,7 @@ This package guarantees compatibility with [version v1.x of Meilisearch](https:/
|
|
76
76
|
|
77
77
|
## 🔧 Installation <!-- omit in toc -->
|
78
78
|
|
79
|
-
This package requires Ruby version
|
79
|
+
This package requires Ruby version 3.0 or later and Rails 6.1 or later. It may work in older versions but it is not officially supported.
|
80
80
|
|
81
81
|
With `gem` in command line:
|
82
82
|
```bash
|
@@ -8,7 +8,7 @@ module MeiliSearch
|
|
8
8
|
index = MeiliSearch::Rails.client.index(document[:index_uid])
|
9
9
|
|
10
10
|
if document[:synchronous]
|
11
|
-
index.delete_document
|
11
|
+
index.delete_document(document[:primary_key]).await
|
12
12
|
else
|
13
13
|
index.delete_document(document[:primary_key])
|
14
14
|
end
|
data/lib/meilisearch-rails.rb
CHANGED
@@ -84,6 +84,22 @@ module MeiliSearch
|
|
84
84
|
def initialize(options, &block)
|
85
85
|
@options = options
|
86
86
|
instance_exec(&block) if block_given?
|
87
|
+
warn_searchable_missing_attributes
|
88
|
+
end
|
89
|
+
|
90
|
+
def warn_searchable_missing_attributes
|
91
|
+
searchables = get_setting(:searchable_attributes)&.map { |searchable| searchable.to_s.split('.').first }
|
92
|
+
attrs = get_setting(:attributes)&.map { |k, _| k.to_s }
|
93
|
+
|
94
|
+
if searchables.present? && attrs.present?
|
95
|
+
(searchables - attrs).each do |missing_searchable|
|
96
|
+
warning = <<~WARNING
|
97
|
+
[meilisearch-rails] #{missing_searchable} declared in searchable_attributes but not in attributes. \
|
98
|
+
Please add it to attributes if it should be searchable.
|
99
|
+
WARNING
|
100
|
+
MeiliSearch::Rails.logger.warn(warning)
|
101
|
+
end
|
102
|
+
end
|
87
103
|
end
|
88
104
|
|
89
105
|
def use_serializer(serializer)
|
@@ -464,8 +480,6 @@ module MeiliSearch
|
|
464
480
|
after_destroy_commit { |searchable| searchable.ms_enqueue_remove_from_index!(ms_synchronous?) }
|
465
481
|
end
|
466
482
|
end
|
467
|
-
|
468
|
-
warn_searchable_missing_attributes
|
469
483
|
end
|
470
484
|
|
471
485
|
def ms_without_auto_index(&block)
|
@@ -555,14 +569,14 @@ module MeiliSearch
|
|
555
569
|
doc = doc.merge ms_pk(options) => primary_key
|
556
570
|
|
557
571
|
if synchronous || options[:synchronous]
|
558
|
-
index.add_documents
|
572
|
+
index.add_documents(doc).await
|
559
573
|
else
|
560
574
|
index.add_documents(doc)
|
561
575
|
end
|
562
576
|
elsif ms_conditional_index?(options) && primary_key.present?
|
563
577
|
# remove non-indexable documents
|
564
578
|
if synchronous || options[:synchronous]
|
565
|
-
index.delete_document
|
579
|
+
index.delete_document(primary_key).await
|
566
580
|
else
|
567
581
|
index.delete_document(primary_key)
|
568
582
|
end
|
@@ -594,7 +608,7 @@ module MeiliSearch
|
|
594
608
|
|
595
609
|
index = ms_ensure_init(options, settings)
|
596
610
|
if synchronous || options[:synchronous]
|
597
|
-
index.delete_document
|
611
|
+
index.delete_document(primary_key).await
|
598
612
|
else
|
599
613
|
index.delete_document(primary_key)
|
600
614
|
end
|
@@ -607,7 +621,7 @@ module MeiliSearch
|
|
607
621
|
next if ms_indexing_disabled?(options)
|
608
622
|
|
609
623
|
index = ms_ensure_init(options, settings)
|
610
|
-
synchronous || options[:synchronous] ? index.delete_all_documents
|
624
|
+
synchronous || options[:synchronous] ? index.delete_all_documents.await : index.delete_all_documents
|
611
625
|
@ms_indexes[MeiliSearch::Rails.active?][settings] = nil
|
612
626
|
end
|
613
627
|
nil
|
@@ -901,19 +915,6 @@ module MeiliSearch
|
|
901
915
|
# We don't know if the attribute has changed, so conservatively assume it has
|
902
916
|
true
|
903
917
|
end
|
904
|
-
|
905
|
-
def warn_searchable_missing_attributes
|
906
|
-
searchables = meilisearch_settings.get_setting(:searchable_attributes)
|
907
|
-
attrs = meilisearch_settings.get_setting(:attributes)&.keys
|
908
|
-
|
909
|
-
if searchables.present? && attrs.present?
|
910
|
-
(searchables.map(&:to_s) - attrs.map(&:to_s)).each do |missing_searchable|
|
911
|
-
MeiliSearch::Rails.logger.warn(
|
912
|
-
"[meilisearch-rails] #{name}##{missing_searchable} declared in searchable_attributes but not in attributes. Please add it to attributes if it should be searchable."
|
913
|
-
)
|
914
|
-
end
|
915
|
-
end
|
916
|
-
end
|
917
918
|
end
|
918
919
|
|
919
920
|
# these are the instance methods included
|
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.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meili
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-25 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.28'
|
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.28'
|
27
27
|
description: Meilisearch integration for Ruby on Rails. See https://github.com/meilisearch/meilisearch
|
28
28
|
email: bonjour@meilisearch.com
|
29
29
|
executables: []
|
@@ -66,14 +66,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.0.0
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.4.19
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Meilisearch integration for Ruby on Rails.
|