elasticsearch_record 5.0.0 → 5.0.1

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: a4f850e5600056256b188825cc8ca7067b4928014a09b05bb18ed37fb648478f
4
- data.tar.gz: 19cec69e3a5a67752f8c94a2b22968e29dd5edf7166e4e205903164387e8606f
3
+ metadata.gz: cef7d68e9ae9718034159014687d3f5237a473cb63b0ec00d0db8e2db17e4fa6
4
+ data.tar.gz: 6de7559f4e5711be72fe942e1fbfdccc6b316e4b958678377173b6e03037b67c
5
5
  SHA512:
6
- metadata.gz: 076f2df28822bba0a2148d2e3043cb403cb04d388c5034056eb7e298004694707b2e2b8c003257f8da4dc5d1bea80ae5bce8b851244cd146232b381ecc35543e
7
- data.tar.gz: 91a406efac0912da2f2427120b0cf1fdbf1ae78166b9853c3af6099b6e19fd4aa09aebf962840f01345d4b32a523a1fd74706f827f86b0804a0f8ffef2199392
6
+ metadata.gz: 8bd4dc770aad866810a674bfb5e91cce295f5659189d73315fe558a9309ffe73c15c7bdeba0b94bcf923058ebcd5d2e33f4652f064a343d4d2cc97a75644c205
7
+ data.tar.gz: abff63bee87a65d7ecb7b9ee26a6063ee812d103f3ff5dcbca90f927e45d052ffdf8ab68950ba7667b27a88296504ee1cd6696ba497cb6944c11a32566f494a7
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # ElasticsearchRecord - CHANGELOG
2
2
 
3
+ ## [5.0.1] - 2026-09-16
4
+ * [add] specs for `Elasticsearch::Column` identity, deduplication & YAML round-trip
5
+ * [fix] `Elasticsearch::Column#==`, `#eql?` & `#hash` also compare `virtual`, `fields`, `properties`, `meta` & `enabled` - same-named columns of different indexes no longer share a single deduplicated object
6
+ * [fix] `Elasticsearch::Column#init_with` & `#encode_with` serialize the elasticsearch-specific attributes
7
+
3
8
  ## [5.0.0] - 2026-09-10
4
9
  * [add] **BREAKING**: requires `activerecord ~> 8.1.0`
5
10
  * [add] `Relation::ValueMethods#limit!` - keeps the `'__max__'` & `Float::INFINITY` limits, which rails now casts through `Integer()`
@@ -22,6 +22,53 @@ module ActiveRecord
22
22
  meta? && meta['comment']
23
23
  end
24
24
 
25
+ def init_with(coder)
26
+ @virtual = coder['virtual']
27
+ @fields = coder['fields']
28
+ @properties = coder['properties']
29
+ @meta = coder['meta']
30
+ @enabled = coder['enabled']
31
+ super
32
+ end
33
+
34
+ def encode_with(coder)
35
+ coder['virtual'] = @virtual
36
+ coder['fields'] = @fields
37
+ coder['properties'] = @properties
38
+ coder['meta'] = @meta
39
+ coder['enabled'] = @enabled
40
+ super
41
+ end
42
+
43
+ # ActiveRecord deduplicates columns process-wide through +Deduplicable+, which
44
+ # keys its registry by +#hash+ & +#eql?+ - so columns that only differ in the
45
+ # elasticsearch-specific attributes must NOT compare equal.
46
+ # Without this a +keyword+ column with a +analyzed+ sub-field would share the
47
+ # object of a same-named +keyword+ column without any fields - whichever index
48
+ # loaded its schema first wins & the other one silently gains or loses its
49
+ # +fields+ (breaking e.g. +where('code.analyzed' => ...)+).
50
+ def ==(other)
51
+ other.is_a?(Column) &&
52
+ super &&
53
+ virtual == other.virtual &&
54
+ fields == other.fields &&
55
+ properties == other.properties &&
56
+ meta == other.meta &&
57
+ enabled == other.enabled
58
+ end
59
+
60
+ alias :eql? :==
61
+
62
+ def hash
63
+ Column.hash ^
64
+ super.hash ^
65
+ virtual.hash ^
66
+ fields.hash ^
67
+ properties.hash ^
68
+ meta.hash ^
69
+ enabled.hash
70
+ end
71
+
25
72
  # returns true if this column is enabled (= searchable by queries)
26
73
  # @return [Boolean]
27
74
  def enabled?
@@ -9,7 +9,7 @@ module ElasticsearchRecord
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 0
12
- TINY = 0
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior