chewy 7.3.4 → 7.3.6
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/.github/dependabot.yml +42 -0
- data/.github/workflows/ruby.yml +4 -4
- data/CHANGELOG.md +20 -0
- data/gemfiles/rails.7.1.activerecord.gemfile +13 -0
- data/lib/chewy/log_subscriber.rb +5 -1
- data/lib/chewy/search/parameters/knn.rb +16 -0
- data/lib/chewy/search/request.rb +14 -3
- data/lib/chewy/version.rb +1 -1
- data/lib/chewy.rb +1 -0
- data/spec/chewy/search/parameters/knn_spec.rb +5 -0
- data/spec/chewy/search/request_spec.rb +9 -7
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5405b97585dccb630ef95340245a390ff7ffe19a1a27e57a35b4f4d6844e2e0
|
|
4
|
+
data.tar.gz: 91570a2fd199d511bf40caf473d8000504cae38a4bb4b68c6f767913033f7234
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8441a05d5a3c55834f7380a1e10b3acb4f01f17b6cafc45e3ccead13f0d7c2a6485447c2bc8461ae5c91b37b36c4d57f140f76cb993ca63777195d64237d8432
|
|
7
|
+
data.tar.gz: 3571db3d5fa632d6ee9c10105578ca8f805090e375372f1ad98a192dca440536f27559be2439d7e75c8ab833f596fc61758d464696ec4ee47942ff29fbffa6d5
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
registries:
|
|
3
|
+
toptal-github:
|
|
4
|
+
type: "git"
|
|
5
|
+
url: "https://github.com"
|
|
6
|
+
username: "x-access-token"
|
|
7
|
+
password: "${{secrets.DEPENDABOT_GITHUB_TOKEN}}"
|
|
8
|
+
|
|
9
|
+
updates:
|
|
10
|
+
- package-ecosystem: bundler
|
|
11
|
+
directory: "/"
|
|
12
|
+
schedule:
|
|
13
|
+
interval: "weekly"
|
|
14
|
+
day: "wednesday"
|
|
15
|
+
time: "07:00"
|
|
16
|
+
pull-request-branch-name:
|
|
17
|
+
separator: "-"
|
|
18
|
+
labels:
|
|
19
|
+
- "no-jira"
|
|
20
|
+
- "ruby"
|
|
21
|
+
- "dependencies"
|
|
22
|
+
reviewers:
|
|
23
|
+
- "toptal/devx"
|
|
24
|
+
registries:
|
|
25
|
+
- toptal-github
|
|
26
|
+
insecure-external-code-execution: allow
|
|
27
|
+
open-pull-requests-limit: 3
|
|
28
|
+
- package-ecosystem: "github-actions"
|
|
29
|
+
directory: "/"
|
|
30
|
+
schedule:
|
|
31
|
+
interval: "weekly"
|
|
32
|
+
day: "wednesday"
|
|
33
|
+
time: "07:00"
|
|
34
|
+
pull-request-branch-name:
|
|
35
|
+
separator: "-"
|
|
36
|
+
labels:
|
|
37
|
+
- "no-jira"
|
|
38
|
+
- "dependencies"
|
|
39
|
+
- "gha"
|
|
40
|
+
reviewers:
|
|
41
|
+
- "toptal/devx"
|
|
42
|
+
open-pull-requests-limit: 3
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
28
|
- uses: ruby/setup-ruby@v1
|
|
29
29
|
with:
|
|
30
30
|
ruby-version: ${{ matrix.ruby }}
|
|
@@ -43,14 +43,14 @@ jobs:
|
|
|
43
43
|
fail-fast: false
|
|
44
44
|
matrix:
|
|
45
45
|
ruby: [ '3.0', '3.1', '3.2' ]
|
|
46
|
-
gemfile: [ rails.6.1.activerecord, rails.7.0.activerecord ]
|
|
46
|
+
gemfile: [ rails.6.1.activerecord, rails.7.0.activerecord, rails.7.1.activerecord ]
|
|
47
47
|
name: ${{ matrix.ruby }}-${{ matrix.gemfile }}
|
|
48
48
|
|
|
49
49
|
env:
|
|
50
50
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
51
51
|
|
|
52
52
|
steps:
|
|
53
|
-
- uses: actions/checkout@
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
54
|
- uses: ruby/setup-ruby@v1
|
|
55
55
|
with:
|
|
56
56
|
ruby-version: ${{ matrix.ruby }}
|
|
@@ -66,7 +66,7 @@ jobs:
|
|
|
66
66
|
rubocop:
|
|
67
67
|
runs-on: ubuntu-latest
|
|
68
68
|
steps:
|
|
69
|
-
- uses: actions/checkout@
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
70
|
- uses: ruby/setup-ruby@v1
|
|
71
71
|
with:
|
|
72
72
|
ruby-version: 2.7
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,26 @@
|
|
|
8
8
|
|
|
9
9
|
### Bugs Fixed
|
|
10
10
|
|
|
11
|
+
## 7.3.5 (2023-12-13)
|
|
12
|
+
|
|
13
|
+
### New Features
|
|
14
|
+
|
|
15
|
+
* [#890](https://github.com/toptal/chewy/pull/890): Add the [`knn`](https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html) option to the request. ([@jkostolansky][])
|
|
16
|
+
|
|
17
|
+
### Changes
|
|
18
|
+
|
|
19
|
+
### Bugs Fixed
|
|
20
|
+
|
|
21
|
+
## 7.3.5 (2023-12-06)
|
|
22
|
+
|
|
23
|
+
### New Features
|
|
24
|
+
|
|
25
|
+
* [#907](https://github.com/toptal/chewy/pull/907): Fix deprecation warning in LogSubscriber for Rails 7.1 ([@alejandroperea](https://github.com/alejandroperea))
|
|
26
|
+
|
|
27
|
+
### Changes
|
|
28
|
+
|
|
29
|
+
### Bugs Fixed
|
|
30
|
+
|
|
11
31
|
## 7.3.4 (2023-08-29)
|
|
12
32
|
|
|
13
33
|
### New Features
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'activejob', '~> 7.1.0'
|
|
4
|
+
gem 'activerecord', '~> 7.1.0'
|
|
5
|
+
gem 'activesupport', '~> 7.1.0'
|
|
6
|
+
gem 'kaminari-core', '~> 1.1.0', require: false
|
|
7
|
+
gem 'parallel', require: false
|
|
8
|
+
gem 'rspec_junit_formatter', '~> 0.4.1'
|
|
9
|
+
gem 'sidekiq', require: false
|
|
10
|
+
|
|
11
|
+
gem 'rexml' if RUBY_VERSION >= '3.0.0'
|
|
12
|
+
|
|
13
|
+
gemspec path: '../'
|
data/lib/chewy/log_subscriber.rb
CHANGED
|
@@ -24,7 +24,11 @@ module Chewy
|
|
|
24
24
|
|
|
25
25
|
subject = payload[:type].presence || payload[:index]
|
|
26
26
|
action = "#{subject} #{action} (#{event.duration.round(1)}ms)"
|
|
27
|
-
action =
|
|
27
|
+
action = if ActiveSupport.version >= Gem::Version.new('7.1')
|
|
28
|
+
color(action, GREEN, bold: true)
|
|
29
|
+
else
|
|
30
|
+
color(action, GREEN, true)
|
|
31
|
+
end
|
|
28
32
|
|
|
29
33
|
debug(" #{action} #{description}")
|
|
30
34
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'chewy/search/parameters/storage'
|
|
2
|
+
|
|
3
|
+
module Chewy
|
|
4
|
+
module Search
|
|
5
|
+
class Parameters
|
|
6
|
+
# Just a standard hash storage. Nothing to see here.
|
|
7
|
+
#
|
|
8
|
+
# @see Chewy::Search::Parameters::HashStorage
|
|
9
|
+
# @see Chewy::Search::Request#knn
|
|
10
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html
|
|
11
|
+
class Knn < Storage
|
|
12
|
+
include HashStorage
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/chewy/search/request.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Chewy
|
|
|
20
20
|
UNDEFINED = Class.new.freeze
|
|
21
21
|
EVERFIELDS = %w[_index _type _id _parent _routing].freeze
|
|
22
22
|
DELEGATED_METHODS = %i[
|
|
23
|
-
query filter post_filter order reorder docvalue_fields
|
|
23
|
+
query filter post_filter knn order reorder docvalue_fields
|
|
24
24
|
track_scores track_total_hits request_cache explain version profile
|
|
25
25
|
search_type preference limit offset terminate_after
|
|
26
26
|
timeout min_score source stored_fields search_after
|
|
@@ -41,7 +41,7 @@ module Chewy
|
|
|
41
41
|
EXTRA_STORAGES = %i[aggs suggest].freeze
|
|
42
42
|
# An array of storage names that are changing the returned hist collection in any way.
|
|
43
43
|
WHERE_STORAGES = %i[
|
|
44
|
-
query filter post_filter none min_score rescore indices_boost collapse
|
|
44
|
+
query filter post_filter knn none min_score rescore indices_boost collapse
|
|
45
45
|
].freeze
|
|
46
46
|
|
|
47
47
|
delegate :hits, :wrappers, :objects, :records, :documents,
|
|
@@ -520,7 +520,18 @@ module Chewy
|
|
|
520
520
|
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/collapse-search-results.html
|
|
521
521
|
# @param value [Hash]
|
|
522
522
|
# @return [Chewy::Search::Request]
|
|
523
|
-
|
|
523
|
+
#
|
|
524
|
+
# @!method knn(value)
|
|
525
|
+
# Replaces the value of the `knn` request part.
|
|
526
|
+
#
|
|
527
|
+
# @example
|
|
528
|
+
# PlacesIndex.knn(field: :vector, query_vector: [4, 2], k: 5, num_candidates: 50)
|
|
529
|
+
# # => <PlacesIndex::Query {..., :body=>{:knn=>{"field"=>:vector, "query_vector"=>[4, 2], "k"=>5, "num_candidates"=>50}}}>
|
|
530
|
+
# @see Chewy::Search::Parameters::Knn
|
|
531
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html
|
|
532
|
+
# @param value [Hash]
|
|
533
|
+
# @return [Chewy::Search::Request]
|
|
534
|
+
%i[request_cache search_type preference timeout limit offset terminate_after min_score ignore_unavailable collapse knn].each do |name|
|
|
524
535
|
define_method name do |value|
|
|
525
536
|
modify(name) { replace!(value) }
|
|
526
537
|
end
|
data/lib/chewy/version.rb
CHANGED
data/lib/chewy.rb
CHANGED
|
@@ -314,14 +314,16 @@ describe Chewy::Search::Request do
|
|
|
314
314
|
end
|
|
315
315
|
end
|
|
316
316
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
.
|
|
317
|
+
%i[collapse knn].each do |name|
|
|
318
|
+
describe "##{name}" do
|
|
319
|
+
specify { expect(subject.send(name, foo: {bar: 42}).render[:body]).to include(name => {'foo' => {bar: 42}}) }
|
|
320
|
+
specify do
|
|
321
|
+
expect(subject.send(name, foo: {bar: 42}).send(name, moo: {baz: 43}).render[:body])
|
|
322
|
+
.to include(name => {'moo' => {baz: 43}})
|
|
323
|
+
end
|
|
324
|
+
specify { expect(subject.send(name, foo: {bar: 42}).send(name, nil).render[:body]).to be_blank }
|
|
325
|
+
specify { expect { subject.send(name, foo: {bar: 42}) }.not_to change { subject.render } }
|
|
322
326
|
end
|
|
323
|
-
specify { expect(subject.collapse(foo: {bar: 42}).collapse(nil).render[:body]).to be_blank }
|
|
324
|
-
specify { expect { subject.collapse(foo: {bar: 42}) }.not_to change { subject.render } }
|
|
325
327
|
end
|
|
326
328
|
|
|
327
329
|
describe '#docvalue_fields' 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.3.
|
|
4
|
+
version: 7.3.6
|
|
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: 2023-
|
|
12
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: database_cleaner
|
|
@@ -240,6 +240,7 @@ files:
|
|
|
240
240
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
241
241
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
242
242
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
243
|
+
- ".github/dependabot.yml"
|
|
243
244
|
- ".github/workflows/ruby.yml"
|
|
244
245
|
- ".gitignore"
|
|
245
246
|
- ".rspec"
|
|
@@ -260,6 +261,7 @@ files:
|
|
|
260
261
|
- gemfiles/rails.6.0.activerecord.gemfile
|
|
261
262
|
- gemfiles/rails.6.1.activerecord.gemfile
|
|
262
263
|
- gemfiles/rails.7.0.activerecord.gemfile
|
|
264
|
+
- gemfiles/rails.7.1.activerecord.gemfile
|
|
263
265
|
- lib/chewy.rb
|
|
264
266
|
- lib/chewy/config.rb
|
|
265
267
|
- lib/chewy/errors.rb
|
|
@@ -322,6 +324,7 @@ files:
|
|
|
322
324
|
- lib/chewy/search/parameters/ignore_unavailable.rb
|
|
323
325
|
- lib/chewy/search/parameters/indices.rb
|
|
324
326
|
- lib/chewy/search/parameters/indices_boost.rb
|
|
327
|
+
- lib/chewy/search/parameters/knn.rb
|
|
325
328
|
- lib/chewy/search/parameters/limit.rb
|
|
326
329
|
- lib/chewy/search/parameters/load.rb
|
|
327
330
|
- lib/chewy/search/parameters/min_score.rb
|
|
@@ -417,6 +420,7 @@ files:
|
|
|
417
420
|
- spec/chewy/search/parameters/ignore_unavailable_spec.rb
|
|
418
421
|
- spec/chewy/search/parameters/indices_spec.rb
|
|
419
422
|
- spec/chewy/search/parameters/integer_storage_examples.rb
|
|
423
|
+
- spec/chewy/search/parameters/knn_spec.rb
|
|
420
424
|
- spec/chewy/search/parameters/limit_spec.rb
|
|
421
425
|
- spec/chewy/search/parameters/load_spec.rb
|
|
422
426
|
- spec/chewy/search/parameters/min_score_spec.rb
|
|
@@ -535,6 +539,7 @@ test_files:
|
|
|
535
539
|
- spec/chewy/search/parameters/ignore_unavailable_spec.rb
|
|
536
540
|
- spec/chewy/search/parameters/indices_spec.rb
|
|
537
541
|
- spec/chewy/search/parameters/integer_storage_examples.rb
|
|
542
|
+
- spec/chewy/search/parameters/knn_spec.rb
|
|
538
543
|
- spec/chewy/search/parameters/limit_spec.rb
|
|
539
544
|
- spec/chewy/search/parameters/load_spec.rb
|
|
540
545
|
- spec/chewy/search/parameters/min_score_spec.rb
|