jay_api 28.4.0 → 29.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1af59670e04b1508c6773538b8d9d0478f1971e80755ea526012eaa44f4717c
4
- data.tar.gz: d23445b944fd8ef0cea8fd628536132fe2cd024ec315b286223b08ecb2c57452
3
+ metadata.gz: 1f1153d9c1260eec0e2b267dbf5ea63074c388f5a72ee4473013322e380388aa
4
+ data.tar.gz: 3e329829a95831222b1d5111de202b1d0a4160b22889f549e81bde8f4c072b10
5
5
  SHA512:
6
- metadata.gz: f6805dc6330cdb960f50af2321112572f9959da7789e02c2810231df24b7a5176686754bb488234e4f64659dbdbdc078985564e5987780cd66e93aaca0e5d0e4
7
- data.tar.gz: ad80fac10a256c1ff8061cc6822fe9d89763e86f9e710cf0b9e7a8f103f864d4dfd24051c90727fb7fc664a0251503a97515beb1d2cd890b3a4cd43a50066490
6
+ metadata.gz: 87460d91ba4fcee072ce01d7b4d9a71d926cf6c1d6a02aa5cb1d8fda8e6ed1e09d510de9e411d980594ee22991a420abf784c60eface6e9d9fa51f1e9563ddf1
7
+ data.tar.gz: 6e64661a3fe9cd20cb9f437e3310d5ccd6ac85d8931a681d571224bec564a51c738a7a198d054b40c8effa2af2514423f64985acdcad8994d2ee89f98df047b6
data/CHANGELOG.md CHANGED
@@ -8,6 +8,21 @@ Please mark backwards incompatible changes with an exclamation mark at the start
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [29.1.0] - 2025-10-22
12
+
13
+ ### Added
14
+ - The `#bool` method to the `QueryBuilder::QueryClauses::Bool` class. This
15
+ allows boolean clauses to be nested.
16
+ - `QueryBuilder#sort` can now receive either the direction of the sorting (`asc`
17
+ or `desc`) or a `Hash` with advanced sorting options. These are relayed
18
+ directly to Elasticsearch.
19
+
20
+ ## [29.0.0] - 2025-08-28
21
+
22
+ ### Changed
23
+ - ! Updated the `git` dependency from `~> 1, >= 1.8.0-1` to `~> 3`.
24
+ - ! Increased the minimum Ruby version requirement to 3.1.0
25
+
11
26
  ## [28.4.0] - 2025-08-26
12
27
 
13
28
  ### Added
data/README.md CHANGED
@@ -5,8 +5,8 @@ while abstracting internal implementations.
5
5
 
6
6
  ## Requirements
7
7
 
8
- * Ruby >= 2.7.0
9
- * Bundler ~> 2, < 2.5.0
8
+ * Ruby >= 3.1.0
9
+ * Bundler ~> 2
10
10
 
11
11
  ## Setup
12
12
 
data/jay_api.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'https://github.com/esrlabs/jay_api'
13
13
  spec.license = 'Apache-2.0'
14
14
 
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
16
16
 
17
17
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
18
 
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency 'activesupport', '~> 7'
33
33
  spec.add_runtime_dependency 'concurrent-ruby', '~> 1'
34
34
  spec.add_runtime_dependency 'elasticsearch', '~> 7', '<= 7.9.0'
35
- spec.add_runtime_dependency 'git', '~> 1', '>= 1.8.0-1'
35
+ spec.add_runtime_dependency 'git', '~> 3'
36
36
  spec.add_runtime_dependency 'logging', '~> 2'
37
37
  spec.add_runtime_dependency 'rspec', '~> 3.0'
38
38
  end
@@ -61,6 +61,19 @@ module JayAPI
61
61
  add_boolean_clause(:must_not, &block)
62
62
  end
63
63
 
64
+ # Adds a nested +Boolean+ clause to the receiver. For this to work the
65
+ # receiver must have an active sub-clause (for example +must+).
66
+ # @yield [JayAPI::Elasticsearch::QueryBuilder::QueryClauses::Bool]
67
+ # Yields the nested boolean clause to the given block.
68
+ # @return [JayAPI::Elasticsearch::QueryBuilder::QueryClauses::Bool]
69
+ # Returns the nested boolean clause.
70
+ def bool(&block)
71
+ nested_bool = self.class.new
72
+ self << nested_bool
73
+ block&.call(nested_bool)
74
+ nested_bool
75
+ end
76
+
64
77
  # Adds a clause to the current sub-clause of the boolean clause.
65
78
  # @param [JayAPI::Elasticsearch::QueryBuilder::QueryClauses::QueryClause]
66
79
  # query_clause The query clause to add.
@@ -64,13 +64,22 @@ module JayAPI
64
64
  # query_builder.sort(age: 'desc')
65
65
  #
66
66
  # Both will produce the same +sort+ clause.
67
+ #
68
+ # It is also possible to pass a Hash with advanced sorting options, for
69
+ # example:
70
+ #
71
+ # query_builder.sort(price: { order: :desc, missing: :_last })
72
+ #
67
73
  # @param [Hash] sort A Hash whose keys are the name of the fields
68
- # and the keys are the direction of the sorting, either +asc+ or
69
- # +desc+.
74
+ # and whose values are either the direction of the sorting (+:asc+ or
75
+ # +:desc+) or a Hash with advanced sort options.
76
+ # @see https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results
70
77
  # @return [QueryBuilder] itself so that other methods can be chained.
71
78
  def sort(sort)
72
79
  check_argument(sort, 'sort', Hash)
73
- @sort.merge!(sort)
80
+ @sort.merge!(
81
+ sort.transform_values { |value| value.is_a?(Hash) ? value : { order: value } }
82
+ )
74
83
  self
75
84
  end
76
85
 
@@ -184,11 +193,7 @@ module JayAPI
184
193
  query_hash[:_source] = @source unless @source.nil?
185
194
  query_hash[:query] = query.to_h
186
195
 
187
- if @sort.any?
188
- query_hash[:sort] = @sort.map do |field, direction|
189
- { field => { order: direction } }
190
- end
191
- end
196
+ query_hash[:sort] = @sort.map { |field, ordering| { field => ordering } } if @sort.any?
192
197
 
193
198
  if @collapse
194
199
  query_hash[:collapse] = {
@@ -2,5 +2,5 @@
2
2
 
3
3
  module JayAPI
4
4
  # JayAPI gem's semantic version
5
- VERSION = '28.4.0'
5
+ VERSION = '29.1.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jay_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 28.4.0
4
+ version: 29.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Accenture-Industry X
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-08-26 00:00:00.000000000 Z
12
+ date: 2025-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -65,20 +65,14 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1'
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: 1.8.0.pre.1
68
+ version: '3'
72
69
  type: :runtime
73
70
  prerelease: false
74
71
  version_requirements: !ruby/object:Gem::Requirement
75
72
  requirements:
76
73
  - - "~>"
77
74
  - !ruby/object:Gem::Version
78
- version: '1'
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: 1.8.0.pre.1
75
+ version: '3'
82
76
  - !ruby/object:Gem::Dependency
83
77
  name: logging
84
78
  requirement: !ruby/object:Gem::Requirement
@@ -218,14 +212,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
212
  requirements:
219
213
  - - ">="
220
214
  - !ruby/object:Gem::Version
221
- version: 2.7.0
215
+ version: 3.1.0
222
216
  required_rubygems_version: !ruby/object:Gem::Requirement
223
217
  requirements:
224
218
  - - ">="
225
219
  - !ruby/object:Gem::Version
226
220
  version: '0'
227
221
  requirements: []
228
- rubygems_version: 3.1.6
222
+ rubygems_version: 3.3.27
229
223
  signing_key:
230
224
  specification_version: 4
231
225
  summary: A collection of classes and modules to access JAY's functionality