algoliasearch-rails 2.2.2 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.MD +9 -0
- data/Gemfile.lock +105 -109
- data/lib/algoliasearch/algolia_job.rb +1 -1
- data/lib/algoliasearch/configuration.rb +16 -4
- data/lib/algoliasearch/version.rb +1 -1
- data/lib/algoliasearch-rails.rb +6 -7
- data/spec/spec_helper.rb +2 -0
- 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: 6c936268f937121a58b8a141df1d9cb5dc25504ff4c25dc3e4d133060162d326
|
4
|
+
data.tar.gz: 8b2262430fc7edab858ce40e6f46638ceb65ddea27f17b2261e2251c93b725b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54ada522502ea04902a815a185d1c7ee016c121ca711a79db89815c3ebf443dd958b68d9b64c7ae48d6260bd423472234babc11c0e6d43f5f0f17793b601d67
|
7
|
+
data.tar.gz: 7ec62bbe246782b6015be92ec55cf680157116e974c88efc5300f528e7324a437b182e7c6e5cde640d18ae5671b0052fad75338a41ed54e0b307c6a1834eaf77
|
data/CHANGELOG.MD
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...master)
|
4
4
|
|
5
|
+
## [2.3.1](https://github.com/algolia/algoliasearch-rails/compare/2.3.0...2.3.1)
|
6
|
+
### Added
|
7
|
+
* Allow ActiveJob queue configuration [`#439`](https://github.com/algolia/algoliasearch-rails/pull/439)
|
8
|
+
* allow to configure user agent and other default options [`#438`](https://github.com/algolia/algoliasearch-rails/pull/438)
|
9
|
+
|
10
|
+
## [2.3.0](https://github.com/algolia/algoliasearch-rails/compare/2.2.2...2.3.0)
|
11
|
+
### Fixed
|
12
|
+
* bugfix: don't consider objectID changed when using custom ID through method [`#436`](https://github.com/algolia/algoliasearch-rails/pull/436)
|
13
|
+
|
5
14
|
## [2.2.2](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...2.2.2)
|
6
15
|
### Fixed
|
7
16
|
* fix: wrong method name [`#429`](https://github.com/algolia/algoliasearch-rails/pull/429)
|
data/Gemfile.lock
CHANGED
@@ -1,47 +1,40 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actioncable (
|
5
|
-
actionpack (=
|
6
|
-
activesupport (=
|
4
|
+
actioncable (6.1.4.7)
|
5
|
+
actionpack (= 6.1.4.7)
|
6
|
+
activesupport (= 6.1.4.7)
|
7
7
|
nio4r (~> 2.0)
|
8
8
|
websocket-driver (>= 0.6.1)
|
9
|
-
actionmailbox (
|
10
|
-
actionpack (=
|
11
|
-
activejob (=
|
12
|
-
activerecord (=
|
13
|
-
activestorage (=
|
14
|
-
activesupport (=
|
9
|
+
actionmailbox (6.1.4.7)
|
10
|
+
actionpack (= 6.1.4.7)
|
11
|
+
activejob (= 6.1.4.7)
|
12
|
+
activerecord (= 6.1.4.7)
|
13
|
+
activestorage (= 6.1.4.7)
|
14
|
+
activesupport (= 6.1.4.7)
|
15
15
|
mail (>= 2.7.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
actionview (= 7.0.4.2)
|
22
|
-
activejob (= 7.0.4.2)
|
23
|
-
activesupport (= 7.0.4.2)
|
16
|
+
actionmailer (6.1.4.7)
|
17
|
+
actionpack (= 6.1.4.7)
|
18
|
+
actionview (= 6.1.4.7)
|
19
|
+
activejob (= 6.1.4.7)
|
20
|
+
activesupport (= 6.1.4.7)
|
24
21
|
mail (~> 2.5, >= 2.5.4)
|
25
|
-
net-imap
|
26
|
-
net-pop
|
27
|
-
net-smtp
|
28
22
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (
|
30
|
-
actionview (=
|
31
|
-
activesupport (=
|
32
|
-
rack (~> 2.0, >= 2.
|
23
|
+
actionpack (6.1.4.7)
|
24
|
+
actionview (= 6.1.4.7)
|
25
|
+
activesupport (= 6.1.4.7)
|
26
|
+
rack (~> 2.0, >= 2.0.9)
|
33
27
|
rack-test (>= 0.6.3)
|
34
28
|
rails-dom-testing (~> 2.0)
|
35
29
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (
|
37
|
-
actionpack (=
|
38
|
-
activerecord (=
|
39
|
-
activestorage (=
|
40
|
-
activesupport (=
|
41
|
-
globalid (>= 0.6.0)
|
30
|
+
actiontext (6.1.4.7)
|
31
|
+
actionpack (= 6.1.4.7)
|
32
|
+
activerecord (= 6.1.4.7)
|
33
|
+
activestorage (= 6.1.4.7)
|
34
|
+
activesupport (= 6.1.4.7)
|
42
35
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (
|
44
|
-
activesupport (=
|
36
|
+
actionview (6.1.4.7)
|
37
|
+
activesupport (= 6.1.4.7)
|
45
38
|
builder (~> 3.1)
|
46
39
|
erubi (~> 1.4)
|
47
40
|
rails-dom-testing (~> 2.0)
|
@@ -51,27 +44,28 @@ GEM
|
|
51
44
|
activemodel (>= 4.1, < 7.1)
|
52
45
|
case_transform (>= 0.2)
|
53
46
|
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
54
|
-
activejob (
|
55
|
-
activesupport (=
|
47
|
+
activejob (6.1.4.7)
|
48
|
+
activesupport (= 6.1.4.7)
|
56
49
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (
|
58
|
-
activesupport (=
|
59
|
-
activerecord (
|
60
|
-
activemodel (=
|
61
|
-
activesupport (=
|
62
|
-
activestorage (
|
63
|
-
actionpack (=
|
64
|
-
activejob (=
|
65
|
-
activerecord (=
|
66
|
-
activesupport (=
|
67
|
-
marcel (~> 1.0)
|
50
|
+
activemodel (6.1.4.7)
|
51
|
+
activesupport (= 6.1.4.7)
|
52
|
+
activerecord (6.1.4.7)
|
53
|
+
activemodel (= 6.1.4.7)
|
54
|
+
activesupport (= 6.1.4.7)
|
55
|
+
activestorage (6.1.4.7)
|
56
|
+
actionpack (= 6.1.4.7)
|
57
|
+
activejob (= 6.1.4.7)
|
58
|
+
activerecord (= 6.1.4.7)
|
59
|
+
activesupport (= 6.1.4.7)
|
60
|
+
marcel (~> 1.0.0)
|
68
61
|
mini_mime (>= 1.1.0)
|
69
|
-
activesupport (
|
62
|
+
activesupport (6.1.4.7)
|
70
63
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
71
64
|
i18n (>= 1.6, < 2)
|
72
65
|
minitest (>= 5.1)
|
73
66
|
tzinfo (~> 2.0)
|
74
|
-
|
67
|
+
zeitwerk (~> 2.3)
|
68
|
+
algolia (2.3.2)
|
75
69
|
faraday (>= 0.15, < 3)
|
76
70
|
faraday-net_http_persistent (>= 0.15, < 3)
|
77
71
|
multi_json (~> 1.0)
|
@@ -79,13 +73,13 @@ GEM
|
|
79
73
|
builder (3.2.4)
|
80
74
|
case_transform (0.2)
|
81
75
|
activesupport
|
82
|
-
concurrent-ruby (1.2.
|
83
|
-
connection_pool (2.
|
76
|
+
concurrent-ruby (1.2.2)
|
77
|
+
connection_pool (2.4.1)
|
84
78
|
crass (1.0.6)
|
85
79
|
date (3.3.3)
|
86
80
|
diff-lcs (1.5.0)
|
87
81
|
erubi (1.12.0)
|
88
|
-
faraday (2.7.
|
82
|
+
faraday (2.7.10)
|
89
83
|
faraday-net_http (>= 2.0, < 3.1)
|
90
84
|
ruby2_keywords (>= 0.0.4)
|
91
85
|
faraday-net_http (3.0.2)
|
@@ -94,16 +88,16 @@ GEM
|
|
94
88
|
net-http-persistent (~> 4.0)
|
95
89
|
globalid (1.1.0)
|
96
90
|
activesupport (>= 5.0)
|
97
|
-
i18n (1.
|
91
|
+
i18n (1.14.1)
|
98
92
|
concurrent-ruby (~> 1.0)
|
99
93
|
json (2.6.3)
|
100
94
|
jsonapi-renderer (0.2.2)
|
101
95
|
kaminari (0.17.0)
|
102
96
|
actionpack (>= 3.0.0)
|
103
97
|
activesupport (>= 3.0.0)
|
104
|
-
loofah (2.
|
98
|
+
loofah (2.21.3)
|
105
99
|
crass (~> 1.0.2)
|
106
|
-
nokogiri (>= 1.
|
100
|
+
nokogiri (>= 1.12.0)
|
107
101
|
mail (2.8.1)
|
108
102
|
mini_mime (>= 0.1.1)
|
109
103
|
net-imap
|
@@ -111,13 +105,13 @@ GEM
|
|
111
105
|
net-smtp
|
112
106
|
marcel (1.0.2)
|
113
107
|
method_source (1.0.0)
|
114
|
-
mini_mime (1.1.
|
115
|
-
mini_portile2 (2.8.
|
116
|
-
minitest (5.
|
108
|
+
mini_mime (1.1.5)
|
109
|
+
mini_portile2 (2.8.4)
|
110
|
+
minitest (5.19.0)
|
117
111
|
multi_json (1.15.0)
|
118
|
-
net-http-persistent (4.0.
|
112
|
+
net-http-persistent (4.0.2)
|
119
113
|
connection_pool (~> 2.2)
|
120
|
-
net-imap (0.3.
|
114
|
+
net-imap (0.3.7)
|
121
115
|
date
|
122
116
|
net-protocol
|
123
117
|
net-pop (0.1.2)
|
@@ -126,72 +120,75 @@ GEM
|
|
126
120
|
timeout
|
127
121
|
net-smtp (0.3.3)
|
128
122
|
net-protocol
|
129
|
-
nio4r (2.5.
|
130
|
-
nokogiri (1.
|
123
|
+
nio4r (2.5.9)
|
124
|
+
nokogiri (1.13.10)
|
131
125
|
mini_portile2 (~> 2.8.0)
|
132
126
|
racc (~> 1.4)
|
133
127
|
psych (5.1.0)
|
134
128
|
stringio
|
135
|
-
racc (1.
|
136
|
-
rack (2.2.
|
137
|
-
rack-test (2.0
|
129
|
+
racc (1.7.1)
|
130
|
+
rack (2.2.8)
|
131
|
+
rack-test (2.1.0)
|
138
132
|
rack (>= 1.3)
|
139
|
-
rails (
|
140
|
-
actioncable (=
|
141
|
-
actionmailbox (=
|
142
|
-
actionmailer (=
|
143
|
-
actionpack (=
|
144
|
-
actiontext (=
|
145
|
-
actionview (=
|
146
|
-
activejob (=
|
147
|
-
activemodel (=
|
148
|
-
activerecord (=
|
149
|
-
activestorage (=
|
150
|
-
activesupport (=
|
133
|
+
rails (6.1.4.7)
|
134
|
+
actioncable (= 6.1.4.7)
|
135
|
+
actionmailbox (= 6.1.4.7)
|
136
|
+
actionmailer (= 6.1.4.7)
|
137
|
+
actionpack (= 6.1.4.7)
|
138
|
+
actiontext (= 6.1.4.7)
|
139
|
+
actionview (= 6.1.4.7)
|
140
|
+
activejob (= 6.1.4.7)
|
141
|
+
activemodel (= 6.1.4.7)
|
142
|
+
activerecord (= 6.1.4.7)
|
143
|
+
activestorage (= 6.1.4.7)
|
144
|
+
activesupport (= 6.1.4.7)
|
151
145
|
bundler (>= 1.15.0)
|
152
|
-
railties (=
|
153
|
-
|
154
|
-
|
146
|
+
railties (= 6.1.4.7)
|
147
|
+
sprockets-rails (>= 2.0.0)
|
148
|
+
rails-dom-testing (2.2.0)
|
149
|
+
activesupport (>= 5.0.0)
|
150
|
+
minitest
|
155
151
|
nokogiri (>= 1.6)
|
156
152
|
rails-html-sanitizer (1.5.0)
|
157
153
|
loofah (~> 2.19, >= 2.19.1)
|
158
|
-
railties (
|
159
|
-
actionpack (=
|
160
|
-
activesupport (=
|
154
|
+
railties (6.1.4.7)
|
155
|
+
actionpack (= 6.1.4.7)
|
156
|
+
activesupport (= 6.1.4.7)
|
161
157
|
method_source
|
162
|
-
rake (>=
|
158
|
+
rake (>= 0.13)
|
163
159
|
thor (~> 1.0)
|
164
|
-
|
165
|
-
rake (12.3.3)
|
160
|
+
rake (10.1.1)
|
166
161
|
rdoc (6.5.0)
|
167
162
|
psych (>= 4.0.0)
|
168
163
|
redgreen (1.2.2)
|
169
|
-
rspec (
|
170
|
-
rspec-core (~>
|
171
|
-
rspec-expectations (~>
|
172
|
-
rspec-mocks (~>
|
173
|
-
rspec-core (
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
rspec-support (~> 3.12.0)
|
178
|
-
rspec-mocks (3.12.3)
|
179
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
180
|
-
rspec-support (~> 3.12.0)
|
181
|
-
rspec-support (3.12.0)
|
164
|
+
rspec (2.99.0)
|
165
|
+
rspec-core (~> 2.99.0)
|
166
|
+
rspec-expectations (~> 2.99.0)
|
167
|
+
rspec-mocks (~> 2.99.0)
|
168
|
+
rspec-core (2.99.2)
|
169
|
+
rspec-expectations (2.99.2)
|
170
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
171
|
+
rspec-mocks (2.99.4)
|
182
172
|
ruby2_keywords (0.0.5)
|
183
|
-
sequel (5.
|
173
|
+
sequel (5.71.0)
|
174
|
+
sprockets (4.2.0)
|
175
|
+
concurrent-ruby (~> 1.0)
|
176
|
+
rack (>= 2.2.4, < 4)
|
177
|
+
sprockets-rails (3.4.2)
|
178
|
+
actionpack (>= 5.2)
|
179
|
+
activesupport (>= 5.2)
|
180
|
+
sprockets (>= 3.0.0)
|
184
181
|
sqlite3 (1.4.4)
|
185
|
-
stringio (3.0.
|
186
|
-
thor (1.2.
|
187
|
-
timeout (0.
|
182
|
+
stringio (3.0.6)
|
183
|
+
thor (1.2.2)
|
184
|
+
timeout (0.4.0)
|
188
185
|
tzinfo (2.0.6)
|
189
186
|
concurrent-ruby (~> 1.0)
|
190
|
-
websocket-driver (0.7.
|
187
|
+
websocket-driver (0.7.6)
|
191
188
|
websocket-extensions (>= 0.1.0)
|
192
189
|
websocket-extensions (0.1.5)
|
193
|
-
will_paginate (
|
194
|
-
zeitwerk (2.6.
|
190
|
+
will_paginate (4.0.0)
|
191
|
+
zeitwerk (2.6.11)
|
195
192
|
|
196
193
|
PLATFORMS
|
197
194
|
ruby
|
@@ -204,13 +201,12 @@ DEPENDENCIES
|
|
204
201
|
jdbc-sqlite3
|
205
202
|
json (>= 1.5.1)
|
206
203
|
kaminari (< 1)
|
207
|
-
rails (~>
|
208
|
-
|
209
|
-
rake (~> 12.2)
|
204
|
+
rails (~> 6.1)
|
205
|
+
rake (~> 10.1.0)
|
210
206
|
rdoc
|
211
207
|
redgreen
|
212
|
-
rspec (
|
213
|
-
sequel (
|
208
|
+
rspec (>= 2.5.0, < 3.0)
|
209
|
+
sequel (>= 4.0)
|
214
210
|
sqlite3 (~> 1.4.0)
|
215
211
|
will_paginate (>= 2.3.15)
|
216
212
|
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module AlgoliaSearch
|
2
2
|
module Configuration
|
3
|
+
REQUIRED_CONFIGURATION = {
|
4
|
+
user_agent: "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{defined?(::Rails::VERSION::STRING) ? ::Rails::VERSION::STRING : 'unknown'})",
|
5
|
+
symbolize_keys: false
|
6
|
+
}
|
7
|
+
|
3
8
|
def initialize
|
4
9
|
@client = nil
|
5
10
|
end
|
@@ -9,10 +14,11 @@ module AlgoliaSearch
|
|
9
14
|
end
|
10
15
|
|
11
16
|
def configuration=(configuration)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
user_agent = [REQUIRED_CONFIGURATION[:user_agent], configuration[:append_to_user_agent]].compact.join('; ')
|
18
|
+
@@configuration = default_configuration
|
19
|
+
.merge(configuration)
|
20
|
+
.merge(REQUIRED_CONFIGURATION)
|
21
|
+
.merge({ user_agent: user_agent })
|
16
22
|
end
|
17
23
|
|
18
24
|
def client_opts
|
@@ -34,5 +40,11 @@ module AlgoliaSearch
|
|
34
40
|
def setup_client
|
35
41
|
@client = Algolia::Search::Client.new(Algolia::Search::Config.new(@@configuration), client_opts)
|
36
42
|
end
|
43
|
+
|
44
|
+
def default_configuration
|
45
|
+
{
|
46
|
+
queue_name: 'algoliasearch'
|
47
|
+
}
|
48
|
+
end
|
37
49
|
end
|
38
50
|
end
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -753,14 +753,13 @@ module AlgoliaSearch
|
|
753
753
|
next if options[:replica]
|
754
754
|
return true if algolia_object_id_changed?(object, options)
|
755
755
|
settings.get_attribute_names(object).each do |k|
|
756
|
-
return true if algolia_attribute_changed?(object, k)
|
757
|
-
# return true if !object.respond_to?(changed_method) || object.send(changed_method)
|
756
|
+
return true if algolia_attribute_changed?(object, k, true)
|
758
757
|
end
|
759
758
|
[options[:if], options[:unless]].each do |condition|
|
760
759
|
case condition
|
761
760
|
when nil
|
762
761
|
when String, Symbol
|
763
|
-
return true if algolia_attribute_changed?(object, condition)
|
762
|
+
return true if algolia_attribute_changed?(object, condition, true)
|
764
763
|
else
|
765
764
|
# if the :if, :unless condition is a anything else,
|
766
765
|
# we have no idea whether we should reindex or not
|
@@ -837,7 +836,7 @@ module AlgoliaSearch
|
|
837
836
|
end
|
838
837
|
|
839
838
|
def algolia_object_id_changed?(o, options = nil)
|
840
|
-
changed = algolia_attribute_changed?(o, algolia_object_id_method(options))
|
839
|
+
changed = algolia_attribute_changed?(o, algolia_object_id_method(options), false)
|
841
840
|
changed.nil? ? false : changed
|
842
841
|
end
|
843
842
|
|
@@ -934,7 +933,7 @@ module AlgoliaSearch
|
|
934
933
|
end
|
935
934
|
end
|
936
935
|
|
937
|
-
def algolia_attribute_changed?(object, attr_name)
|
936
|
+
def algolia_attribute_changed?(object, attr_name, default)
|
938
937
|
# if one of two method is implemented, we return its result
|
939
938
|
# true/false means whether it has changed or not
|
940
939
|
# +#{attr_name}_changed?+ always defined for automatic attributes but deprecated after Rails 5.2
|
@@ -963,8 +962,8 @@ module AlgoliaSearch
|
|
963
962
|
return object.send("will_save_change_to_#{attr_name}?")
|
964
963
|
end
|
965
964
|
|
966
|
-
# We don't know if the attribute has changed, so
|
967
|
-
|
965
|
+
# We don't know if the attribute has changed, so return the default passed
|
966
|
+
default
|
968
967
|
end
|
969
968
|
|
970
969
|
def automatic_changed_method?(object, method_name)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|