chewy 7.2.1 → 7.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/dependabot.yml +42 -0
- data/.github/workflows/ruby.yml +28 -26
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +196 -0
- data/Gemfile +4 -3
- data/README.md +203 -20
- data/chewy.gemspec +4 -18
- data/gemfiles/base.gemfile +12 -0
- data/gemfiles/rails.6.1.activerecord.gemfile +2 -1
- data/gemfiles/{rails.5.2.activerecord.gemfile → rails.7.0.activerecord.gemfile} +6 -3
- data/gemfiles/{rails.6.0.activerecord.gemfile → rails.7.1.activerecord.gemfile} +6 -3
- data/lib/chewy/config.rb +22 -14
- data/lib/chewy/elastic_client.rb +31 -0
- data/lib/chewy/errors.rb +11 -2
- data/lib/chewy/fields/base.rb +69 -13
- data/lib/chewy/fields/root.rb +2 -10
- data/lib/chewy/index/actions.rb +11 -16
- data/lib/chewy/index/adapter/active_record.rb +18 -3
- data/lib/chewy/index/adapter/object.rb +0 -10
- data/lib/chewy/index/adapter/orm.rb +4 -14
- data/lib/chewy/index/crutch.rb +15 -7
- data/lib/chewy/index/import/bulk_builder.rb +219 -32
- data/lib/chewy/index/import/bulk_request.rb +1 -1
- data/lib/chewy/index/import/routine.rb +3 -3
- data/lib/chewy/index/import.rb +45 -31
- data/lib/chewy/index/mapping.rb +2 -2
- data/lib/chewy/index/observe/active_record_methods.rb +87 -0
- data/lib/chewy/index/observe/callback.rb +34 -0
- data/lib/chewy/index/observe.rb +3 -58
- data/lib/chewy/index/syncer.rb +1 -1
- data/lib/chewy/index.rb +25 -0
- data/lib/chewy/journal.rb +17 -6
- data/lib/chewy/log_subscriber.rb +5 -1
- data/lib/chewy/minitest/helpers.rb +77 -0
- data/lib/chewy/minitest/search_index_receiver.rb +3 -1
- data/lib/chewy/rake_helper.rb +92 -11
- data/lib/chewy/rspec/build_query.rb +12 -0
- data/lib/chewy/rspec/helpers.rb +55 -0
- data/lib/chewy/rspec/update_index.rb +14 -7
- data/lib/chewy/rspec.rb +2 -0
- data/lib/chewy/runtime/version.rb +1 -1
- data/lib/chewy/runtime.rb +1 -1
- data/lib/chewy/search/parameters/collapse.rb +16 -0
- data/lib/chewy/search/parameters/ignore_unavailable.rb +27 -0
- data/lib/chewy/search/parameters/indices.rb +1 -1
- data/lib/chewy/search/parameters/knn.rb +16 -0
- data/lib/chewy/search/parameters/order.rb +6 -19
- data/lib/chewy/search/parameters/storage.rb +1 -1
- data/lib/chewy/search/parameters/track_total_hits.rb +16 -0
- data/lib/chewy/search/parameters.rb +4 -4
- data/lib/chewy/search/request.rb +74 -16
- data/lib/chewy/search/scoping.rb +1 -1
- data/lib/chewy/search.rb +5 -2
- data/lib/chewy/stash.rb +3 -3
- data/lib/chewy/strategy/active_job.rb +1 -1
- data/lib/chewy/strategy/atomic_no_refresh.rb +18 -0
- data/lib/chewy/strategy/base.rb +10 -0
- data/lib/chewy/strategy/delayed_sidekiq/scheduler.rb +168 -0
- data/lib/chewy/strategy/delayed_sidekiq/worker.rb +76 -0
- data/lib/chewy/strategy/delayed_sidekiq.rb +30 -0
- data/lib/chewy/strategy/lazy_sidekiq.rb +64 -0
- data/lib/chewy/strategy/sidekiq.rb +1 -1
- data/lib/chewy/strategy.rb +3 -0
- data/lib/chewy/version.rb +1 -1
- data/lib/chewy.rb +21 -14
- data/lib/tasks/chewy.rake +18 -2
- data/migration_guide.md +1 -1
- data/spec/chewy/config_spec.rb +2 -2
- data/spec/chewy/elastic_client_spec.rb +26 -0
- data/spec/chewy/fields/base_spec.rb +39 -18
- data/spec/chewy/index/actions_spec.rb +10 -10
- data/spec/chewy/index/adapter/active_record_spec.rb +88 -0
- data/spec/chewy/index/import/bulk_builder_spec.rb +309 -1
- data/spec/chewy/index/import/routine_spec.rb +5 -5
- data/spec/chewy/index/import_spec.rb +48 -26
- data/spec/chewy/index/observe/active_record_methods_spec.rb +68 -0
- data/spec/chewy/index/observe/callback_spec.rb +139 -0
- data/spec/chewy/index/observe_spec.rb +27 -0
- data/spec/chewy/journal_spec.rb +13 -49
- data/spec/chewy/minitest/helpers_spec.rb +111 -1
- data/spec/chewy/minitest/search_index_receiver_spec.rb +6 -4
- data/spec/chewy/rake_helper_spec.rb +170 -0
- data/spec/chewy/rspec/build_query_spec.rb +34 -0
- data/spec/chewy/rspec/helpers_spec.rb +61 -0
- data/spec/chewy/search/pagination/kaminari_examples.rb +1 -1
- data/spec/chewy/search/pagination/kaminari_spec.rb +1 -1
- data/spec/chewy/search/parameters/collapse_spec.rb +5 -0
- data/spec/chewy/search/parameters/ignore_unavailable_spec.rb +67 -0
- data/spec/chewy/search/parameters/knn_spec.rb +5 -0
- data/spec/chewy/search/parameters/order_spec.rb +18 -11
- data/spec/chewy/search/parameters/track_total_hits_spec.rb +5 -0
- data/spec/chewy/search/parameters_spec.rb +6 -1
- data/spec/chewy/search/request_spec.rb +58 -9
- data/spec/chewy/search_spec.rb +9 -0
- data/spec/chewy/strategy/active_job_spec.rb +8 -8
- data/spec/chewy/strategy/atomic_no_refresh_spec.rb +60 -0
- data/spec/chewy/strategy/delayed_sidekiq_spec.rb +208 -0
- data/spec/chewy/strategy/lazy_sidekiq_spec.rb +214 -0
- data/spec/chewy/strategy/sidekiq_spec.rb +4 -4
- data/spec/chewy_spec.rb +10 -7
- data/spec/spec_helper.rb +1 -2
- data/spec/support/active_record.rb +8 -1
- metadata +45 -264
- data/lib/chewy/backports/deep_dup.rb +0 -46
- data/lib/chewy/backports/duplicable.rb +0 -91
- data/lib/chewy/index/import/thread_safe_progress_bar.rb +0 -40
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chewy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toptal, LLC
|
@@ -9,162 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: database_cleaner
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: elasticsearch-extensions
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rspec
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 3.7.0
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 3.7.0
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rspec-collection_matchers
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rspec-its
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rubocop
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '='
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '1.11'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - '='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.11'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: sqlite3
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: timecop
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: method_source
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
|
-
- !ruby/object:Gem::Dependency
|
155
|
-
name: unparser
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '0'
|
161
|
-
type: :development
|
162
|
-
prerelease: false
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
14
|
- !ruby/object:Gem::Dependency
|
169
15
|
name: activesupport
|
170
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,30 +31,22 @@ dependencies:
|
|
185
31
|
requirements:
|
186
32
|
- - ">="
|
187
33
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
189
|
-
|
190
|
-
prerelease: false
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - ">="
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: 6.3.0
|
196
|
-
- !ruby/object:Gem::Dependency
|
197
|
-
name: elasticsearch-dsl
|
198
|
-
requirement: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - ">="
|
34
|
+
version: 7.14.0
|
35
|
+
- - "<"
|
201
36
|
- !ruby/object:Gem::Version
|
202
|
-
version: '
|
37
|
+
version: '8'
|
203
38
|
type: :runtime
|
204
39
|
prerelease: false
|
205
40
|
version_requirements: !ruby/object:Gem::Requirement
|
206
41
|
requirements:
|
207
42
|
- - ">="
|
208
43
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
44
|
+
version: 7.14.0
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '8'
|
210
48
|
- !ruby/object:Gem::Dependency
|
211
|
-
name:
|
49
|
+
name: elasticsearch-dsl
|
212
50
|
requirement: !ruby/object:Gem::Requirement
|
213
51
|
requirements:
|
214
52
|
- - ">="
|
@@ -230,9 +68,11 @@ executables: []
|
|
230
68
|
extensions: []
|
231
69
|
extra_rdoc_files: []
|
232
70
|
files:
|
71
|
+
- ".github/CODEOWNERS"
|
233
72
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
234
73
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
235
74
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
75
|
+
- ".github/dependabot.yml"
|
236
76
|
- ".github/workflows/ruby.yml"
|
237
77
|
- ".gitignore"
|
238
78
|
- ".rspec"
|
@@ -249,13 +89,13 @@ files:
|
|
249
89
|
- Rakefile
|
250
90
|
- chewy.gemspec
|
251
91
|
- filters
|
252
|
-
- gemfiles/
|
253
|
-
- gemfiles/rails.6.0.activerecord.gemfile
|
92
|
+
- gemfiles/base.gemfile
|
254
93
|
- gemfiles/rails.6.1.activerecord.gemfile
|
94
|
+
- gemfiles/rails.7.0.activerecord.gemfile
|
95
|
+
- gemfiles/rails.7.1.activerecord.gemfile
|
255
96
|
- lib/chewy.rb
|
256
|
-
- lib/chewy/backports/deep_dup.rb
|
257
|
-
- lib/chewy/backports/duplicable.rb
|
258
97
|
- lib/chewy/config.rb
|
98
|
+
- lib/chewy/elastic_client.rb
|
259
99
|
- lib/chewy/errors.rb
|
260
100
|
- lib/chewy/fields/base.rb
|
261
101
|
- lib/chewy/fields/root.rb
|
@@ -272,9 +112,10 @@ files:
|
|
272
112
|
- lib/chewy/index/import/bulk_request.rb
|
273
113
|
- lib/chewy/index/import/journal_builder.rb
|
274
114
|
- lib/chewy/index/import/routine.rb
|
275
|
-
- lib/chewy/index/import/thread_safe_progress_bar.rb
|
276
115
|
- lib/chewy/index/mapping.rb
|
277
116
|
- lib/chewy/index/observe.rb
|
117
|
+
- lib/chewy/index/observe/active_record_methods.rb
|
118
|
+
- lib/chewy/index/observe/callback.rb
|
278
119
|
- lib/chewy/index/settings.rb
|
279
120
|
- lib/chewy/index/specification.rb
|
280
121
|
- lib/chewy/index/syncer.rb
|
@@ -290,6 +131,8 @@ files:
|
|
290
131
|
- lib/chewy/rake_helper.rb
|
291
132
|
- lib/chewy/repository.rb
|
292
133
|
- lib/chewy/rspec.rb
|
134
|
+
- lib/chewy/rspec/build_query.rb
|
135
|
+
- lib/chewy/rspec/helpers.rb
|
293
136
|
- lib/chewy/rspec/update_index.rb
|
294
137
|
- lib/chewy/runtime.rb
|
295
138
|
- lib/chewy/runtime/version.rb
|
@@ -299,6 +142,7 @@ files:
|
|
299
142
|
- lib/chewy/search/parameters.rb
|
300
143
|
- lib/chewy/search/parameters/aggs.rb
|
301
144
|
- lib/chewy/search/parameters/allow_partial_search_results.rb
|
145
|
+
- lib/chewy/search/parameters/collapse.rb
|
302
146
|
- lib/chewy/search/parameters/concerns/bool_storage.rb
|
303
147
|
- lib/chewy/search/parameters/concerns/hash_storage.rb
|
304
148
|
- lib/chewy/search/parameters/concerns/integer_storage.rb
|
@@ -309,8 +153,10 @@ files:
|
|
309
153
|
- lib/chewy/search/parameters/explain.rb
|
310
154
|
- lib/chewy/search/parameters/filter.rb
|
311
155
|
- lib/chewy/search/parameters/highlight.rb
|
156
|
+
- lib/chewy/search/parameters/ignore_unavailable.rb
|
312
157
|
- lib/chewy/search/parameters/indices.rb
|
313
158
|
- lib/chewy/search/parameters/indices_boost.rb
|
159
|
+
- lib/chewy/search/parameters/knn.rb
|
314
160
|
- lib/chewy/search/parameters/limit.rb
|
315
161
|
- lib/chewy/search/parameters/load.rb
|
316
162
|
- lib/chewy/search/parameters/min_score.rb
|
@@ -333,6 +179,7 @@ files:
|
|
333
179
|
- lib/chewy/search/parameters/terminate_after.rb
|
334
180
|
- lib/chewy/search/parameters/timeout.rb
|
335
181
|
- lib/chewy/search/parameters/track_scores.rb
|
182
|
+
- lib/chewy/search/parameters/track_total_hits.rb
|
336
183
|
- lib/chewy/search/parameters/version.rb
|
337
184
|
- lib/chewy/search/query_proxy.rb
|
338
185
|
- lib/chewy/search/request.rb
|
@@ -343,8 +190,13 @@ files:
|
|
343
190
|
- lib/chewy/strategy.rb
|
344
191
|
- lib/chewy/strategy/active_job.rb
|
345
192
|
- lib/chewy/strategy/atomic.rb
|
193
|
+
- lib/chewy/strategy/atomic_no_refresh.rb
|
346
194
|
- lib/chewy/strategy/base.rb
|
347
195
|
- lib/chewy/strategy/bypass.rb
|
196
|
+
- lib/chewy/strategy/delayed_sidekiq.rb
|
197
|
+
- lib/chewy/strategy/delayed_sidekiq/scheduler.rb
|
198
|
+
- lib/chewy/strategy/delayed_sidekiq/worker.rb
|
199
|
+
- lib/chewy/strategy/lazy_sidekiq.rb
|
348
200
|
- lib/chewy/strategy/sidekiq.rb
|
349
201
|
- lib/chewy/strategy/urgent.rb
|
350
202
|
- lib/chewy/version.rb
|
@@ -353,6 +205,7 @@ files:
|
|
353
205
|
- lib/tasks/chewy.rake
|
354
206
|
- migration_guide.md
|
355
207
|
- spec/chewy/config_spec.rb
|
208
|
+
- spec/chewy/elastic_client_spec.rb
|
356
209
|
- spec/chewy/fields/base_spec.rb
|
357
210
|
- spec/chewy/fields/root_spec.rb
|
358
211
|
- spec/chewy/fields/time_fields_spec.rb
|
@@ -366,6 +219,8 @@ files:
|
|
366
219
|
- spec/chewy/index/import/routine_spec.rb
|
367
220
|
- spec/chewy/index/import_spec.rb
|
368
221
|
- spec/chewy/index/mapping_spec.rb
|
222
|
+
- spec/chewy/index/observe/active_record_methods_spec.rb
|
223
|
+
- spec/chewy/index/observe/callback_spec.rb
|
369
224
|
- spec/chewy/index/observe_spec.rb
|
370
225
|
- spec/chewy/index/settings_spec.rb
|
371
226
|
- spec/chewy/index/specification_spec.rb
|
@@ -379,6 +234,8 @@ files:
|
|
379
234
|
- spec/chewy/multi_search_spec.rb
|
380
235
|
- spec/chewy/rake_helper_spec.rb
|
381
236
|
- spec/chewy/repository_spec.rb
|
237
|
+
- spec/chewy/rspec/build_query_spec.rb
|
238
|
+
- spec/chewy/rspec/helpers_spec.rb
|
382
239
|
- spec/chewy/rspec/update_index_spec.rb
|
383
240
|
- spec/chewy/runtime/version_spec.rb
|
384
241
|
- spec/chewy/runtime_spec.rb
|
@@ -387,13 +244,16 @@ files:
|
|
387
244
|
- spec/chewy/search/pagination/kaminari_spec.rb
|
388
245
|
- spec/chewy/search/parameters/aggs_spec.rb
|
389
246
|
- spec/chewy/search/parameters/bool_storage_examples.rb
|
247
|
+
- spec/chewy/search/parameters/collapse_spec.rb
|
390
248
|
- spec/chewy/search/parameters/docvalue_fields_spec.rb
|
391
249
|
- spec/chewy/search/parameters/explain_spec.rb
|
392
250
|
- spec/chewy/search/parameters/filter_spec.rb
|
393
251
|
- spec/chewy/search/parameters/hash_storage_examples.rb
|
394
252
|
- spec/chewy/search/parameters/highlight_spec.rb
|
253
|
+
- spec/chewy/search/parameters/ignore_unavailable_spec.rb
|
395
254
|
- spec/chewy/search/parameters/indices_spec.rb
|
396
255
|
- spec/chewy/search/parameters/integer_storage_examples.rb
|
256
|
+
- spec/chewy/search/parameters/knn_spec.rb
|
397
257
|
- spec/chewy/search/parameters/limit_spec.rb
|
398
258
|
- spec/chewy/search/parameters/load_spec.rb
|
399
259
|
- spec/chewy/search/parameters/min_score_spec.rb
|
@@ -419,6 +279,7 @@ files:
|
|
419
279
|
- spec/chewy/search/parameters/terminate_after_spec.rb
|
420
280
|
- spec/chewy/search/parameters/timeout_spec.rb
|
421
281
|
- spec/chewy/search/parameters/track_scores_spec.rb
|
282
|
+
- spec/chewy/search/parameters/track_total_hits_spec.rb
|
422
283
|
- spec/chewy/search/parameters/version_spec.rb
|
423
284
|
- spec/chewy/search/parameters_spec.rb
|
424
285
|
- spec/chewy/search/query_proxy_spec.rb
|
@@ -428,7 +289,10 @@ files:
|
|
428
289
|
- spec/chewy/search_spec.rb
|
429
290
|
- spec/chewy/stash_spec.rb
|
430
291
|
- spec/chewy/strategy/active_job_spec.rb
|
292
|
+
- spec/chewy/strategy/atomic_no_refresh_spec.rb
|
431
293
|
- spec/chewy/strategy/atomic_spec.rb
|
294
|
+
- spec/chewy/strategy/delayed_sidekiq_spec.rb
|
295
|
+
- spec/chewy/strategy/lazy_sidekiq_spec.rb
|
432
296
|
- spec/chewy/strategy/sidekiq_spec.rb
|
433
297
|
- spec/chewy/strategy_spec.rb
|
434
298
|
- spec/chewy_spec.rb
|
@@ -439,7 +303,8 @@ files:
|
|
439
303
|
homepage: https://github.com/toptal/chewy
|
440
304
|
licenses:
|
441
305
|
- MIT
|
442
|
-
metadata:
|
306
|
+
metadata:
|
307
|
+
rubygems_mfa_required: 'true'
|
443
308
|
post_install_message:
|
444
309
|
rdoc_options: []
|
445
310
|
require_paths:
|
@@ -455,92 +320,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
455
320
|
- !ruby/object:Gem::Version
|
456
321
|
version: '0'
|
457
322
|
requirements: []
|
458
|
-
rubygems_version: 3.
|
323
|
+
rubygems_version: 3.4.10
|
459
324
|
signing_key:
|
460
325
|
specification_version: 4
|
461
326
|
summary: Elasticsearch ODM client wrapper
|
462
|
-
test_files:
|
463
|
-
- spec/chewy/config_spec.rb
|
464
|
-
- spec/chewy/fields/base_spec.rb
|
465
|
-
- spec/chewy/fields/root_spec.rb
|
466
|
-
- spec/chewy/fields/time_fields_spec.rb
|
467
|
-
- spec/chewy/index/actions_spec.rb
|
468
|
-
- spec/chewy/index/adapter/active_record_spec.rb
|
469
|
-
- spec/chewy/index/adapter/object_spec.rb
|
470
|
-
- spec/chewy/index/aliases_spec.rb
|
471
|
-
- spec/chewy/index/import/bulk_builder_spec.rb
|
472
|
-
- spec/chewy/index/import/bulk_request_spec.rb
|
473
|
-
- spec/chewy/index/import/journal_builder_spec.rb
|
474
|
-
- spec/chewy/index/import/routine_spec.rb
|
475
|
-
- spec/chewy/index/import_spec.rb
|
476
|
-
- spec/chewy/index/mapping_spec.rb
|
477
|
-
- spec/chewy/index/observe_spec.rb
|
478
|
-
- spec/chewy/index/settings_spec.rb
|
479
|
-
- spec/chewy/index/specification_spec.rb
|
480
|
-
- spec/chewy/index/syncer_spec.rb
|
481
|
-
- spec/chewy/index/witchcraft_spec.rb
|
482
|
-
- spec/chewy/index/wrapper_spec.rb
|
483
|
-
- spec/chewy/index_spec.rb
|
484
|
-
- spec/chewy/journal_spec.rb
|
485
|
-
- spec/chewy/minitest/helpers_spec.rb
|
486
|
-
- spec/chewy/minitest/search_index_receiver_spec.rb
|
487
|
-
- spec/chewy/multi_search_spec.rb
|
488
|
-
- spec/chewy/rake_helper_spec.rb
|
489
|
-
- spec/chewy/repository_spec.rb
|
490
|
-
- spec/chewy/rspec/update_index_spec.rb
|
491
|
-
- spec/chewy/runtime/version_spec.rb
|
492
|
-
- spec/chewy/runtime_spec.rb
|
493
|
-
- spec/chewy/search/loader_spec.rb
|
494
|
-
- spec/chewy/search/pagination/kaminari_examples.rb
|
495
|
-
- spec/chewy/search/pagination/kaminari_spec.rb
|
496
|
-
- spec/chewy/search/parameters/aggs_spec.rb
|
497
|
-
- spec/chewy/search/parameters/bool_storage_examples.rb
|
498
|
-
- spec/chewy/search/parameters/docvalue_fields_spec.rb
|
499
|
-
- spec/chewy/search/parameters/explain_spec.rb
|
500
|
-
- spec/chewy/search/parameters/filter_spec.rb
|
501
|
-
- spec/chewy/search/parameters/hash_storage_examples.rb
|
502
|
-
- spec/chewy/search/parameters/highlight_spec.rb
|
503
|
-
- spec/chewy/search/parameters/indices_spec.rb
|
504
|
-
- spec/chewy/search/parameters/integer_storage_examples.rb
|
505
|
-
- spec/chewy/search/parameters/limit_spec.rb
|
506
|
-
- spec/chewy/search/parameters/load_spec.rb
|
507
|
-
- spec/chewy/search/parameters/min_score_spec.rb
|
508
|
-
- spec/chewy/search/parameters/none_spec.rb
|
509
|
-
- spec/chewy/search/parameters/offset_spec.rb
|
510
|
-
- spec/chewy/search/parameters/order_spec.rb
|
511
|
-
- spec/chewy/search/parameters/post_filter_spec.rb
|
512
|
-
- spec/chewy/search/parameters/preference_spec.rb
|
513
|
-
- spec/chewy/search/parameters/profile_spec.rb
|
514
|
-
- spec/chewy/search/parameters/query_spec.rb
|
515
|
-
- spec/chewy/search/parameters/query_storage_examples.rb
|
516
|
-
- spec/chewy/search/parameters/request_cache_spec.rb
|
517
|
-
- spec/chewy/search/parameters/rescore_spec.rb
|
518
|
-
- spec/chewy/search/parameters/script_fields_spec.rb
|
519
|
-
- spec/chewy/search/parameters/search_after_spec.rb
|
520
|
-
- spec/chewy/search/parameters/search_type_spec.rb
|
521
|
-
- spec/chewy/search/parameters/source_spec.rb
|
522
|
-
- spec/chewy/search/parameters/storage_spec.rb
|
523
|
-
- spec/chewy/search/parameters/stored_fields_spec.rb
|
524
|
-
- spec/chewy/search/parameters/string_array_storage_examples.rb
|
525
|
-
- spec/chewy/search/parameters/string_storage_examples.rb
|
526
|
-
- spec/chewy/search/parameters/suggest_spec.rb
|
527
|
-
- spec/chewy/search/parameters/terminate_after_spec.rb
|
528
|
-
- spec/chewy/search/parameters/timeout_spec.rb
|
529
|
-
- spec/chewy/search/parameters/track_scores_spec.rb
|
530
|
-
- spec/chewy/search/parameters/version_spec.rb
|
531
|
-
- spec/chewy/search/parameters_spec.rb
|
532
|
-
- spec/chewy/search/query_proxy_spec.rb
|
533
|
-
- spec/chewy/search/request_spec.rb
|
534
|
-
- spec/chewy/search/response_spec.rb
|
535
|
-
- spec/chewy/search/scrolling_spec.rb
|
536
|
-
- spec/chewy/search_spec.rb
|
537
|
-
- spec/chewy/stash_spec.rb
|
538
|
-
- spec/chewy/strategy/active_job_spec.rb
|
539
|
-
- spec/chewy/strategy/atomic_spec.rb
|
540
|
-
- spec/chewy/strategy/sidekiq_spec.rb
|
541
|
-
- spec/chewy/strategy_spec.rb
|
542
|
-
- spec/chewy_spec.rb
|
543
|
-
- spec/spec_helper.rb
|
544
|
-
- spec/support/active_record.rb
|
545
|
-
- spec/support/class_helpers.rb
|
546
|
-
- spec/support/fail_helpers.rb
|
327
|
+
test_files: []
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'chewy/backports/duplicable'
|
2
|
-
|
3
|
-
class Object
|
4
|
-
# Returns a deep copy of object if it's duplicable. If it's
|
5
|
-
# not duplicable, returns +self+.
|
6
|
-
#
|
7
|
-
# object = Object.new
|
8
|
-
# dup = object.deep_dup
|
9
|
-
# dup.instance_variable_set(:@a, 1)
|
10
|
-
#
|
11
|
-
# object.instance_variable_defined?(:@a) # => false
|
12
|
-
# dup.instance_variable_defined?(:@a) # => true
|
13
|
-
def deep_dup
|
14
|
-
duplicable? ? dup : self
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class Array
|
19
|
-
# Returns a deep copy of array.
|
20
|
-
#
|
21
|
-
# array = [1, [2, 3]]
|
22
|
-
# dup = array.deep_dup
|
23
|
-
# dup[1][2] = 4
|
24
|
-
#
|
25
|
-
# array[1][2] # => nil
|
26
|
-
# dup[1][2] # => 4
|
27
|
-
def deep_dup
|
28
|
-
map(&:deep_dup)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class Hash
|
33
|
-
# Returns a deep copy of hash.
|
34
|
-
#
|
35
|
-
# hash = { a: { b: 'b' } }
|
36
|
-
# dup = hash.deep_dup
|
37
|
-
# dup[:a][:c] = 'c'
|
38
|
-
#
|
39
|
-
# hash[:a][:c] # => nil
|
40
|
-
# dup[:a][:c] # => "c"
|
41
|
-
def deep_dup
|
42
|
-
each_with_object(dup) do |(key, value), hash|
|
43
|
-
hash[key.deep_dup] = value.deep_dup
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Most objects are cloneable, but not all. For example you can't dup +nil+:
|
3
|
-
#
|
4
|
-
# nil.dup # => TypeError: can't dup NilClass
|
5
|
-
#
|
6
|
-
# Classes may signal their instances are not duplicable removing +dup+/+clone+
|
7
|
-
# or raising exceptions from them. So, to dup an arbitrary object you normally
|
8
|
-
# use an optimistic approach and are ready to catch an exception, say:
|
9
|
-
#
|
10
|
-
# arbitrary_object.dup rescue object
|
11
|
-
#
|
12
|
-
# Rails dups objects in a few critical spots where they are not that arbitrary.
|
13
|
-
# That rescue is very expensive (like 40 times slower than a predicate), and it
|
14
|
-
# is often triggered.
|
15
|
-
#
|
16
|
-
# That's why we hardcode the following cases and check duplicable? instead of
|
17
|
-
# using that rescue idiom.
|
18
|
-
#++
|
19
|
-
class Object
|
20
|
-
# Can you safely dup this object?
|
21
|
-
#
|
22
|
-
# False for +nil+, +false+, +true+, symbol, and number objects;
|
23
|
-
# true otherwise.
|
24
|
-
def duplicable?
|
25
|
-
true
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class NilClass
|
30
|
-
# +nil+ is not duplicable:
|
31
|
-
#
|
32
|
-
# nil.duplicable? # => false
|
33
|
-
# nil.dup # => TypeError: can't dup NilClass
|
34
|
-
def duplicable?
|
35
|
-
false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class FalseClass
|
40
|
-
# +false+ is not duplicable:
|
41
|
-
#
|
42
|
-
# false.duplicable? # => false
|
43
|
-
# false.dup # => TypeError: can't dup FalseClass
|
44
|
-
def duplicable?
|
45
|
-
false
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class TrueClass
|
50
|
-
# +true+ is not duplicable:
|
51
|
-
#
|
52
|
-
# true.duplicable? # => false
|
53
|
-
# true.dup # => TypeError: can't dup TrueClass
|
54
|
-
def duplicable?
|
55
|
-
false
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Symbol
|
60
|
-
# Symbols are not duplicable:
|
61
|
-
#
|
62
|
-
# :my_symbol.duplicable? # => false
|
63
|
-
# :my_symbol.dup # => TypeError: can't dup Symbol
|
64
|
-
def duplicable?
|
65
|
-
false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
class Numeric
|
70
|
-
# Numbers are not duplicable:
|
71
|
-
#
|
72
|
-
# 3.duplicable? # => false
|
73
|
-
# 3.dup # => TypeError: can't dup Fixnum
|
74
|
-
def duplicable?
|
75
|
-
false
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
require 'bigdecimal'
|
80
|
-
class BigDecimal
|
81
|
-
begin
|
82
|
-
BigDecimal('4.56').dup
|
83
|
-
|
84
|
-
def duplicable?
|
85
|
-
true
|
86
|
-
end
|
87
|
-
rescue TypeError
|
88
|
-
# can't dup, so use superclass implementation
|
89
|
-
nil
|
90
|
-
end
|
91
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Chewy
|
2
|
-
class Index
|
3
|
-
module Import
|
4
|
-
# This class performs the threading for parallel import to avoid concurrency during progressbar output.
|
5
|
-
#
|
6
|
-
# @see Chewy::Type::Import::ClassMethods#import with `parallel: true` option
|
7
|
-
class ThreadSafeProgressBar
|
8
|
-
def initialize(enabled)
|
9
|
-
@enabled = enabled
|
10
|
-
|
11
|
-
return unless @enabled
|
12
|
-
|
13
|
-
@mutex = Mutex.new
|
14
|
-
@released = false
|
15
|
-
@progressbar = ProgressBar.create total: nil
|
16
|
-
Thread.new do
|
17
|
-
ActiveRecord::Base.connection_pool.with_connection do
|
18
|
-
@mutex.synchronize { @released = true }
|
19
|
-
@progressbar.total = yield
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def increment(value)
|
25
|
-
return unless @enabled
|
26
|
-
|
27
|
-
@mutex.synchronize do
|
28
|
-
@progressbar.progress += value
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def wait_until_ready
|
33
|
-
return true unless @enabled
|
34
|
-
|
35
|
-
@mutex.synchronize { @released } until @released
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|