chewy 7.0.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -26
- data/CHANGELOG.md +11 -0
- data/README.md +27 -38
- data/lib/chewy/fields/root.rb +1 -2
- data/lib/chewy/index.rb +4 -15
- data/lib/chewy/index/actions.rb +1 -3
- data/lib/chewy/index/aliases.rb +1 -3
- data/lib/chewy/railtie.rb +2 -18
- data/lib/chewy/search/loader.rb +2 -12
- data/lib/chewy/search/parameters/indices.rb +12 -57
- data/lib/chewy/search/request.rb +20 -40
- data/lib/chewy/search/response.rb +1 -1
- data/lib/chewy/search/scrolling.rb +1 -1
- data/lib/chewy/stash.rb +2 -5
- data/lib/chewy/type/import/bulk_request.rb +1 -2
- data/lib/chewy/type/import/journal_builder.rb +1 -2
- data/lib/chewy/type/import/routine.rb +2 -2
- data/lib/chewy/type/mapping.rb +1 -1
- data/lib/chewy/type/syncer.rb +1 -4
- data/lib/chewy/version.rb +1 -1
- data/lib/tasks/chewy.rake +10 -10
- data/migration_guide.md +6 -3
- data/spec/chewy/fields/base_spec.rb +4 -4
- data/spec/chewy/fields/root_spec.rb +4 -4
- data/spec/chewy/index/specification_spec.rb +13 -13
- data/spec/chewy/index_spec.rb +1 -3
- data/spec/chewy/journal_spec.rb +4 -4
- data/spec/chewy/runtime_spec.rb +1 -1
- data/spec/chewy/search/loader_spec.rb +0 -16
- data/spec/chewy/search/parameters/indices_spec.rb +25 -110
- data/spec/chewy/search/request_spec.rb +11 -28
- data/spec/chewy/search/scrolling_spec.rb +2 -8
- data/spec/chewy/search_spec.rb +2 -2
- data/spec/chewy/type/import/bulk_request_spec.rb +0 -6
- data/spec/chewy/type/import/journal_builder_spec.rb +0 -4
- data/spec/chewy/type/import_spec.rb +2 -2
- data/spec/chewy/type/mapping_spec.rb +5 -37
- metadata +2 -5
- data/lib/chewy/search/parameters/types.rb +0 -20
- data/spec/chewy/search/parameters/types_spec.rb +0 -5
@@ -29,7 +29,6 @@ describe Chewy::Type::Import::JournalBuilder, :orm do
|
|
29
29
|
expect(subject.bulk_body).to eq([{
|
30
30
|
index: {
|
31
31
|
_index: 'chewy_journal',
|
32
|
-
_type: 'journal',
|
33
32
|
data: {
|
34
33
|
'index_name' => 'namespace/cities',
|
35
34
|
'type_name' => 'city',
|
@@ -48,7 +47,6 @@ describe Chewy::Type::Import::JournalBuilder, :orm do
|
|
48
47
|
expect(subject.bulk_body).to eq([{
|
49
48
|
index: {
|
50
49
|
_index: 'chewy_journal',
|
51
|
-
_type: 'journal',
|
52
50
|
data: {
|
53
51
|
'index_name' => 'namespace/cities',
|
54
52
|
'type_name' => 'city',
|
@@ -69,7 +67,6 @@ describe Chewy::Type::Import::JournalBuilder, :orm do
|
|
69
67
|
expect(subject.bulk_body).to eq([{
|
70
68
|
index: {
|
71
69
|
_index: 'chewy_journal',
|
72
|
-
_type: 'journal',
|
73
70
|
data: {
|
74
71
|
'index_name' => 'namespace/countries',
|
75
72
|
'type_name' => 'country',
|
@@ -81,7 +78,6 @@ describe Chewy::Type::Import::JournalBuilder, :orm do
|
|
81
78
|
}, {
|
82
79
|
index: {
|
83
80
|
_index: 'chewy_journal',
|
84
|
-
_type: 'journal',
|
85
81
|
data: {
|
86
82
|
'index_name' => 'namespace/countries',
|
87
83
|
'type_name' => 'country',
|
@@ -366,8 +366,8 @@ describe Chewy::Type::Import do
|
|
366
366
|
|
367
367
|
# Full match doesn't work here.
|
368
368
|
expect(payload[:errors][:update].keys).to match([
|
369
|
-
hash_including('type' => 'document_missing_exception', 'reason' => '[
|
370
|
-
hash_including('type' => 'document_missing_exception', 'reason' => '[
|
369
|
+
hash_including('type' => 'document_missing_exception', 'reason' => '[_doc][1]: document missing'),
|
370
|
+
hash_including('type' => 'document_missing_exception', 'reason' => '[_doc][3]: document missing')
|
371
371
|
])
|
372
372
|
expect(payload[:errors][:update].values).to eq([['1'], ['3']])
|
373
373
|
expect(imported_cities).to match_array([
|
@@ -59,7 +59,7 @@ describe Chewy::Type::Mapping do
|
|
59
59
|
Chewy.default_root_options = previous_options
|
60
60
|
end
|
61
61
|
|
62
|
-
specify { expect(product.mappings_hash
|
62
|
+
specify { expect(product.mappings_hash).to include(_all: {enabled: false}) }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -90,12 +90,11 @@ describe Chewy::Type::Mapping do
|
|
90
90
|
before do
|
91
91
|
stub_index(:products) do
|
92
92
|
define_type :product do
|
93
|
-
root
|
93
|
+
root other_option: 'nothing' do
|
94
94
|
field :name do
|
95
95
|
field :last_name # will be redefined in the following root flock
|
96
96
|
end
|
97
97
|
end
|
98
|
-
root _parent: 'something_else'
|
99
98
|
root other_option: 'option_value' do
|
100
99
|
field :identifier
|
101
100
|
field :name, type: 'integer'
|
@@ -105,47 +104,16 @@ describe Chewy::Type::Mapping do
|
|
105
104
|
end
|
106
105
|
|
107
106
|
specify do
|
108
|
-
expect(product.mappings_hash).to eq(
|
107
|
+
expect(product.mappings_hash).to eq(
|
109
108
|
properties: {
|
110
109
|
name: {type: 'integer'},
|
111
110
|
identifier: {type: Chewy.default_field_type}
|
112
111
|
},
|
113
|
-
other_option: 'option_value'
|
114
|
-
|
115
|
-
})
|
112
|
+
other_option: 'option_value'
|
113
|
+
)
|
116
114
|
end
|
117
115
|
end
|
118
116
|
end
|
119
|
-
|
120
|
-
context 'parent-child relationship' do
|
121
|
-
context do
|
122
|
-
before do
|
123
|
-
stub_index(:products) do
|
124
|
-
define_type :product do
|
125
|
-
root _parent: 'project', parent_id: -> { project_id } do
|
126
|
-
field :name, 'surname'
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
specify { expect(product.mappings_hash[:product][:_parent]).to eq(type: 'project') }
|
133
|
-
end
|
134
|
-
|
135
|
-
context do
|
136
|
-
before do
|
137
|
-
stub_index(:products) do
|
138
|
-
define_type :product do
|
139
|
-
root parent: {'type' => 'project'}, parent_id: -> { project_id } do
|
140
|
-
field :name, 'surname'
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
specify { expect(product.mappings_hash[:product][:_parent]).to eq('type' => 'project') }
|
147
|
-
end
|
148
|
-
end
|
149
117
|
end
|
150
118
|
|
151
119
|
describe '.supports_outdated_sync?' do
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toptal, LLC
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -335,7 +335,6 @@ files:
|
|
335
335
|
- lib/chewy/search/parameters/terminate_after.rb
|
336
336
|
- lib/chewy/search/parameters/timeout.rb
|
337
337
|
- lib/chewy/search/parameters/track_scores.rb
|
338
|
-
- lib/chewy/search/parameters/types.rb
|
339
338
|
- lib/chewy/search/parameters/version.rb
|
340
339
|
- lib/chewy/search/query_proxy.rb
|
341
340
|
- lib/chewy/search/request.rb
|
@@ -434,7 +433,6 @@ files:
|
|
434
433
|
- spec/chewy/search/parameters/terminate_after_spec.rb
|
435
434
|
- spec/chewy/search/parameters/timeout_spec.rb
|
436
435
|
- spec/chewy/search/parameters/track_scores_spec.rb
|
437
|
-
- spec/chewy/search/parameters/types_spec.rb
|
438
436
|
- spec/chewy/search/parameters/version_spec.rb
|
439
437
|
- spec/chewy/search/parameters_spec.rb
|
440
438
|
- spec/chewy/search/query_proxy_spec.rb
|
@@ -553,7 +551,6 @@ test_files:
|
|
553
551
|
- spec/chewy/search/parameters/terminate_after_spec.rb
|
554
552
|
- spec/chewy/search/parameters/timeout_spec.rb
|
555
553
|
- spec/chewy/search/parameters/track_scores_spec.rb
|
556
|
-
- spec/chewy/search/parameters/types_spec.rb
|
557
554
|
- spec/chewy/search/parameters/version_spec.rb
|
558
555
|
- spec/chewy/search/parameters_spec.rb
|
559
556
|
- spec/chewy/search/query_proxy_spec.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'chewy/search/parameters/storage'
|
2
|
-
|
3
|
-
module Chewy
|
4
|
-
module Search
|
5
|
-
class Parameters
|
6
|
-
# A standard string array storage with one exception: rendering is empty.
|
7
|
-
#
|
8
|
-
# @see Chewy::Search::Parameters::StringArrayStorage
|
9
|
-
class Types < Storage
|
10
|
-
include StringArrayStorage
|
11
|
-
|
12
|
-
# Doesn't render anything, has specialized rendering logic in
|
13
|
-
# {Chewy::Search::Request}
|
14
|
-
#
|
15
|
-
# @return [nil]
|
16
|
-
def render; end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|