elasticsearch_record 1.8.1 → 1.8.2

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: ef01a33de054cbae1fe582ba5f7d8a5910c73dd81e3395f8b6c07ec9d3a5fbe2
4
- data.tar.gz: d574bafc90b201869727539fd0a0c148118d6f666f9f29400690613bd7cbbaa8
3
+ metadata.gz: bbb80c1852041338e02e17314a2a70e852db077e2724383fe05d1990dc5c601e
4
+ data.tar.gz: 5d1f2b445e83e602b16ac571b8b3824784490f9c365a304b4be06aaa02620cb2
5
5
  SHA512:
6
- metadata.gz: 89ac7c99f35a36650c2ac8f00600f0c702ed8ec4c4aaa5d28ad86c329a66be3625d063ada9dd8c6630b8b30eea1a5283a0231a60c0d8021242adeae4efe86316
7
- data.tar.gz: b44f713a1650100a925c94349fcb9fdce4b72bf5acb901c5ff04b871e0586115bf5e08e42f38cd9ecb0e550663977da48e430a739b67230ced4eb29aa4f5bb8b
6
+ metadata.gz: 80ac0419ba02c1d7cc563446067caff43f7ee5b1a92c1155b5d3c2871652b06d5a8998aae4da6ee5c44289c7579a87b1346c15ae15630c11ab8cded34412e524
7
+ data.tar.gz: 1559d1ab3873e002c867c88726358a4d1c3f875e087f8b37ec58d9c8ee196fc757490c246409c1bc32871e9210b617e6c48473c7fe6fe68e97ab47e66da010ec
data/README.md CHANGED
@@ -14,8 +14,10 @@ _ElasticsearchRecord is a ActiveRecord adapter and provides similar functionalit
14
14
 
15
15
  **PLEASE NOTE:**
16
16
 
17
- - This is the `rails-7-1-stable`-branch, which only supports rails **7.1** _(see section 'Rails_Versions' for supported versions)_
17
+ - This is the `main`-branch, which currently supports rails **7.1** _(see section 'Rails_Versions' for supported versions)_
18
18
  - supports ActiveRecord ~> 7.1 + Elasticsearch >= 7.17
19
+ - added features up to Elasticsearch `8.16.1`
20
+ - tested with Elasticsearch `8.15.2`
19
21
 
20
22
  -----
21
23
 
@@ -48,6 +50,7 @@ gem 'elasticsearch_record', '~> 1.8'
48
50
 
49
51
  # alternative
50
52
  gem 'elasticsearch_record', git: 'https://github.com/ruby-smart/elasticsearch_record', branch: 'rails-7-1-stable'
53
+ gem 'elasticsearch_record', git: 'https://github.com/ruby-smart/elasticsearch_record', branch: 'rails-70-stable'
51
54
 
52
55
  ```
53
56
 
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ElasticsearchRecord - CHANGELOG
2
2
 
3
+ ## [1.8.2] - 2024-11-26
4
+ * [fix] `ElasticsearchRecord::Relation::QueryMethods#build_query_clause` to raise an exception on `nil` assignments
5
+ * [fix] `Arel::Visitors::ElasticsearchBase#compile` to always reset temporary assignments _(causes missing assignments after a query-build-exception)_
6
+ * [fix] `Arel::Nodes::SelectAgg` to not merge nil-values
7
+ * [add] elasticsearch mapping type _(semantic_text)_
8
+
3
9
  ## [1.8.1] - 2024-05-07
4
10
  * [add] new elasticsearch mapping types _(percolator, geo, vector, texts, ...)_
5
11
  * [ref] `ElasticsearchRecord::Relation#limit` to detect `Float::INFINITY` to also set the **max_result_window**
@@ -18,7 +18,7 @@ module ActiveRecord
18
18
  :integer_range, :float_range, :long_range, :double_range, :date_range, :ip_range,
19
19
  :ip, :version, :murmur3,
20
20
  :aggregate_metric_double, :histogram,
21
- :text, :match_only_text, :completion, :search_as_you_type, :token_count,
21
+ :text, :match_only_text, :completion, :search_as_you_type, :token_count, :semantic_text,
22
22
  :dense_vector, :sparse_vector, :rank_feature, :rank_features,
23
23
  :geo_point, :geo_shape, :point, :shape,
24
24
  :percolator
@@ -9,7 +9,7 @@ module Arel # :nodoc: all
9
9
  end
10
10
 
11
11
  def right
12
- return expr[1].reduce({}) { |m, data| m.merge(data) } if expr[1].is_a?(Array)
12
+ return expr[1].reduce({}) { |m, data| data ? m.merge(data) : m } if expr[1].is_a?(Array)
13
13
 
14
14
  expr[1]
15
15
  end
@@ -27,11 +27,6 @@ module Arel # :nodoc: all
27
27
  def initialize(connection)
28
28
  super()
29
29
  @connection = connection
30
-
31
- # required for nested assignment.
32
- # see +#assign+ method
33
- @nested = false
34
- @nested_args = []
35
30
  end
36
31
 
37
32
  def dispatch_as(mode)
@@ -45,6 +40,13 @@ module Arel # :nodoc: all
45
40
  end
46
41
 
47
42
  def compile(node, collector = Arel::Collectors::ElasticsearchQuery.new)
43
+ # IMPORTANT: To prevent persistent assigned variables due *accept* exceptions, those must be 'reset' before each compile.
44
+ #
45
+ # required for nested assignment.
46
+ # see +#assign+ method
47
+ @nested = false
48
+ @nested_args = []
49
+
48
50
  # we don't need to forward the collector each time - we just set it and always access it, when we need.
49
51
  self.collector = collector
50
52
 
@@ -9,7 +9,7 @@ module ElasticsearchRecord
9
9
  module VERSION
10
10
  MAJOR = 1
11
11
  MINOR = 8
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -316,6 +316,12 @@ module ElasticsearchRecord
316
316
  end
317
317
 
318
318
  def build_query_clause(kind, data, rest = [])
319
+ # prevent empty data clauses
320
+ # e.g. [nil] - which will cause possible query-exceptions
321
+ if data.blank? || (data.is_a?(Array) && data.all?(&:blank?))
322
+ raise ArgumentError, "Unable to build query clause for '#{kind}' without any data @ #{klass.name}!"
323
+ end
324
+
319
325
  ElasticsearchRecord::Relation::QueryClause.new(kind, Array.wrap(data), rest.extract_options!)
320
326
  end
321
327
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2024-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  requirements: []
224
- rubygems_version: 3.3.26
224
+ rubygems_version: 3.4.19
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: ActiveRecord adapter for Elasticsearch