chewy 7.0.1 → 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 +7 -3
- 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 +0 -19
- 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 -6
- data/.github/workflows/ruby.yml +0 -94
- 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.0
|
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
|
@@ -248,7 +248,6 @@ files:
|
|
248
248
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
249
249
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
250
250
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
251
|
-
- ".github/workflows/ruby.yml"
|
252
251
|
- ".gitignore"
|
253
252
|
- ".rspec"
|
254
253
|
- ".rubocop.yml"
|
@@ -336,7 +335,6 @@ files:
|
|
336
335
|
- lib/chewy/search/parameters/terminate_after.rb
|
337
336
|
- lib/chewy/search/parameters/timeout.rb
|
338
337
|
- lib/chewy/search/parameters/track_scores.rb
|
339
|
-
- lib/chewy/search/parameters/types.rb
|
340
338
|
- lib/chewy/search/parameters/version.rb
|
341
339
|
- lib/chewy/search/query_proxy.rb
|
342
340
|
- lib/chewy/search/request.rb
|
@@ -435,7 +433,6 @@ files:
|
|
435
433
|
- spec/chewy/search/parameters/terminate_after_spec.rb
|
436
434
|
- spec/chewy/search/parameters/timeout_spec.rb
|
437
435
|
- spec/chewy/search/parameters/track_scores_spec.rb
|
438
|
-
- spec/chewy/search/parameters/types_spec.rb
|
439
436
|
- spec/chewy/search/parameters/version_spec.rb
|
440
437
|
- spec/chewy/search/parameters_spec.rb
|
441
438
|
- spec/chewy/search/query_proxy_spec.rb
|
@@ -554,7 +551,6 @@ test_files:
|
|
554
551
|
- spec/chewy/search/parameters/terminate_after_spec.rb
|
555
552
|
- spec/chewy/search/parameters/timeout_spec.rb
|
556
553
|
- spec/chewy/search/parameters/track_scores_spec.rb
|
557
|
-
- spec/chewy/search/parameters/types_spec.rb
|
558
554
|
- spec/chewy/search/parameters/version_spec.rb
|
559
555
|
- spec/chewy/search/parameters_spec.rb
|
560
556
|
- spec/chewy/search/query_proxy_spec.rb
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
tests:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [2.6, 2.7]
|
12
|
-
gemfile: [rails.5.2.activerecord, rails.6.0.activerecord, rails.6.1.activerecord]
|
13
|
-
name: ${{ matrix.ruby }}-${{ matrix.gemfile }}
|
14
|
-
|
15
|
-
env:
|
16
|
-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
17
|
-
|
18
|
-
steps:
|
19
|
-
- uses: actions/checkout@v2
|
20
|
-
- uses: ruby/setup-ruby@v1
|
21
|
-
with:
|
22
|
-
ruby-version: ${{ matrix.ruby }}
|
23
|
-
bundler-cache: true
|
24
|
-
- name: Run Elasticsearch
|
25
|
-
uses: elastic/elastic-github-actions/elasticsearch@master
|
26
|
-
with:
|
27
|
-
stack-version: 7.10.1
|
28
|
-
port: 9250
|
29
|
-
- name: Tests
|
30
|
-
run: bundle exec rspec
|
31
|
-
|
32
|
-
ruby-3-0-activerecord-6-1:
|
33
|
-
runs-on: ubuntu-latest
|
34
|
-
env:
|
35
|
-
BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
|
36
|
-
steps:
|
37
|
-
- uses: actions/checkout@v2
|
38
|
-
- uses: ruby/setup-ruby@v1
|
39
|
-
with:
|
40
|
-
ruby-version: '3.0'
|
41
|
-
bundler-cache: true
|
42
|
-
- name: Run Elasticsearch
|
43
|
-
uses: elastic/elastic-github-actions/elasticsearch@master
|
44
|
-
with:
|
45
|
-
stack-version: 7.10.1
|
46
|
-
port: 9250
|
47
|
-
- name: Tests
|
48
|
-
run: bundle exec rspec
|
49
|
-
|
50
|
-
ruby-3-0-activerecord-6-1-es6:
|
51
|
-
runs-on: ubuntu-latest
|
52
|
-
env:
|
53
|
-
BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
|
54
|
-
steps:
|
55
|
-
- uses: actions/checkout@v2
|
56
|
-
- uses: ruby/setup-ruby@v1
|
57
|
-
with:
|
58
|
-
ruby-version: '3.0'
|
59
|
-
bundler-cache: true
|
60
|
-
- name: Run Elasticsearch
|
61
|
-
uses: elastic/elastic-github-actions/elasticsearch@master
|
62
|
-
with:
|
63
|
-
stack-version: 6.8.15
|
64
|
-
port: 9250
|
65
|
-
- name: Tests
|
66
|
-
run: bundle exec rspec
|
67
|
-
|
68
|
-
ruby-2-7-activerecord-6-1-es6:
|
69
|
-
runs-on: ubuntu-latest
|
70
|
-
env:
|
71
|
-
BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
|
72
|
-
steps:
|
73
|
-
- uses: actions/checkout@v2
|
74
|
-
- uses: ruby/setup-ruby@v1
|
75
|
-
with:
|
76
|
-
ruby-version: 2.7
|
77
|
-
bundler-cache: true
|
78
|
-
- name: Run Elasticsearch
|
79
|
-
uses: elastic/elastic-github-actions/elasticsearch@master
|
80
|
-
with:
|
81
|
-
stack-version: 6.8.15
|
82
|
-
port: 9250
|
83
|
-
- name: Tests
|
84
|
-
run: bundle exec rspec
|
85
|
-
|
86
|
-
rubocop:
|
87
|
-
runs-on: ubuntu-latest
|
88
|
-
steps:
|
89
|
-
- uses: actions/checkout@v2
|
90
|
-
- uses: ruby/setup-ruby@v1
|
91
|
-
with:
|
92
|
-
ruby-version: 2.7
|
93
|
-
bundler-cache: true
|
94
|
-
- run: bundle exec rubocop --format simple
|
@@ -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
|