elasticsearch_record 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f50568400141462093f5d91bf5b26efb44a52b9529577d5e72a4d3699a57717
4
- data.tar.gz: 89536ffacc4ddd5fb4d0334eda843d206c25fc867664f6f9454ee07d921ec712
3
+ metadata.gz: b6e4ca9acc6ee9abda4a3dacec4a75f9f1af77c361dbff3b53aa30648dfa5a5f
4
+ data.tar.gz: f6cf2edda611efb7daa6585764c09c2320040c8970555d64dab96ced763d2f19
5
5
  SHA512:
6
- metadata.gz: 20d82567d738f3f5fa78cdd1bb2595ea7cd068dd16a14fbda56b4c88450a33cac5b32106652401854e0085e1c4378cce6b3ef23983b04ec71fb14f931628c19e
7
- data.tar.gz: 3bcd72650c2d0817048edf3eff0be6ba8de4cc568b04203c3ec9631ccd4ef269b1c91f6f70d90dc05419357e5f4d3c3f164b4b4345f72c54c9d0cfabe15d3103
6
+ metadata.gz: 1d9327c0b6500d47ec5459ebd5e6053d8178d59b33cd690d5f9a2752ec22cc52d2728b295dd4644c5f7fa6b794c6a8d69305b372c6c138e2ae8c717500669453
7
+ data.tar.gz: 050e345874250113d23c69d4de6d3c8f35c7c6b4538fe8d1ee3dbeaf86a64dc7c745175a8301c5d78121481927bff34033a321e390fbaddf3356110951afb3c4
data/README.md CHANGED
@@ -56,6 +56,7 @@ Or install it yourself as:
56
56
  ## Setup
57
57
 
58
58
  ### a) Update your **database.yml** and add a elasticsearch connection:
59
+
59
60
  ```yml
60
61
  # config/database.yml
61
62
 
@@ -115,6 +116,7 @@ end
115
116
  ```
116
117
 
117
118
  ### c) Create a model that inherits from `ElasticsearchRecord::Base` model.
119
+
118
120
  ```ruby
119
121
  # app/models/application_elasticsearch_record.rb
120
122
 
@@ -135,6 +137,7 @@ end
135
137
  ```
136
138
 
137
139
  ### d) have FUN with your model:
140
+
138
141
  ```ruby
139
142
  scope = Search
140
143
  .where(name: 'Custom Object Name')
@@ -155,12 +158,13 @@ scope.where(kind: :undefined).offset(10).update_all(name: "New Name")
155
158
 
156
159
  ## Active Record Query Interface
157
160
 
158
- ### Refactored ```where``` method:
161
+ ### Refactored `where` method:
159
162
  Different to the default where-method you can now use it in different ways.
160
163
 
161
164
  Using it by default with a Hash, the method decides itself to either add a filter, or must_not clause.
162
165
 
163
- _Hint: If not provided through ```#kind```-method a default kind **:bool** will be used._
166
+ _Hint: If not provided through `#kind`-method a default kind **:bool** will be used._
167
+
164
168
  ```ruby
165
169
  # use it by default
166
170
  Search.where(name: 'A nice object')
@@ -213,7 +217,6 @@ results_count = scope.count
213
217
  # > 5
214
218
  total = scope.total
215
219
  # > 3335
216
-
217
220
  ```
218
221
 
219
222
  ### Available query/relation chain methods
@@ -322,7 +325,6 @@ Elasticsearch's default value for queries without a **size** is forced to **10**
322
325
  To provide a similar behaviour as the (my)SQL interface,
323
326
  this can be automatically set to the `max_result_window` value by calling `.limit(nil)` on the models' relation.
324
327
 
325
-
326
328
  ```ruby
327
329
  SearchUser.where(name: 'Peter').limit(nil)
328
330
  # returns a maximum of 10 items ...
@@ -350,6 +352,7 @@ SearchUser.where(name: 'Peter').limit(nil)
350
352
  Quick access to model-related methods for easier access without creating a overcomplicated method call on the models connection...
351
353
 
352
354
  Access these methods through the model class method `.api`.
355
+
353
356
  ```ruby
354
357
  # returns mapping of model class
355
358
  klass.api.mappings
@@ -523,7 +526,6 @@ class AddTests < ActiveRecord::Migration[7.0]
523
526
  end
524
527
  ```
525
528
 
526
-
527
529
  ## environment-related-table-name:
528
530
  Using the `_env_table_name`-method will resolve the table (index) name within the current environment,
529
531
  even if the environments shares the same cluster ...
@@ -533,11 +535,14 @@ Within the migration the `_env_table_name`-method must be used in combination wi
533
535
 
534
536
  **Example:**
535
537
  Production uses a index suffix with '-pro', development uses '-dev' - they share the same cluster, but different indexes.
538
+
536
539
  For the **settings** table:
537
- - settings-pro
538
- - settings-dev
540
+
541
+ * settings-pro
542
+ * settings-dev
539
543
 
540
544
  A single migration can be created to be used within each environment:
545
+
541
546
  ```ruby
542
547
  # Example migration
543
548
  class AddSettings < ActiveRecord::Migration[7.0]
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ElasticsearchRecord - CHANGELOG
2
2
 
3
+ ## [1.5.1] - 2023-07-11
4
+ * [fix] `ElasticsearchRecord::ModelApi` 'drop!' & 'truncate!' methods to support correct parameter 'confirm'
5
+ * [ref] improved yard documentation
6
+
3
7
  ## [1.5.0] - 2023-07-10
4
8
  * [add] additional `ElasticsearchRecord::ModelApi` methods **drop!** & **truncate!**, which have to be called with a `confirm:true` parameter
5
9
  * [add] `.ElasticsearchRecord::Base.delegate_query_nil_limit` to automatically delegate a relations `limit(nil)`-call to the **max_result_window** _(set to 10.000 as default)_
@@ -40,4 +40,5 @@ DESC
40
40
  spec.add_development_dependency 'rake', "~> 13.0"
41
41
  spec.add_development_dependency 'yard', '~> 0.9'
42
42
  spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
43
+ spec.add_development_dependency 'yard-relative_markdown_links', '>= 0.4'
43
44
  end
@@ -100,7 +100,7 @@ module ActiveRecord
100
100
  end
101
101
 
102
102
  # returns the meta hash
103
- # @param [Hash]
103
+ # @return [Hash]
104
104
  def meta
105
105
  __get_attribute(:meta) || {}
106
106
  end
@@ -9,7 +9,7 @@ module ElasticsearchRecord
9
9
  module VERSION
10
10
  MAJOR = 1
11
11
  MINOR = 5
12
- TINY = 0
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -33,8 +33,8 @@ module ElasticsearchRecord
33
33
  # drop!(confirm: true)
34
34
  # truncate!(confirm: true)
35
35
  %w(drop truncate).each do |method|
36
- define_method("#{method}!") do |confirmed: false|
37
- raise "#{method} of table '#{_index_name}' aborted!\nexecution not confirmed!\ncall with: #{klass}.api.#{method}!(confirmed: true)" unless confirmed
36
+ define_method("#{method}!") do |confirm: false|
37
+ raise "#{method} of table '#{_index_name}' aborted!\nexecution not confirmed!\ncall with: #{klass}.api.#{method}!(confirm: true)" unless confirm
38
38
  _connection.send("#{method}_table", _index_name)
39
39
  end
40
40
  end
@@ -68,6 +68,84 @@ module ElasticsearchRecord
68
68
  end
69
69
  end
70
70
 
71
+ # -- DYNAMIC METHOD DOCUMENTATION FOR YARD -------------------------------------------------------------------------
72
+
73
+ # @!method open!
74
+ # Shortcut to open the closed index.
75
+ # @return [Boolean] acknowledged status
76
+
77
+ # @!method close!
78
+ # Shortcut to close the opened index.
79
+ # @return [Boolean] acknowledged status
80
+
81
+ # @!method refresh!
82
+ # Shortcut to refresh the index.
83
+ # @return [Boolean] result state (returns false if refreshing failed)
84
+
85
+ # @!method block!
86
+ # Shortcut to block write access on the index
87
+ # @return [Boolean] acknowledged status
88
+
89
+ # @!method unblock!
90
+ # Shortcut to unblock all blocked accesses on the index
91
+ # @return [Boolean] acknowledged status
92
+
93
+ # @!method drop!(confirm: false)
94
+ # Shortcut to drop the index
95
+ # @param confirm
96
+ # @return [Boolean] acknowledged status
97
+
98
+ # @!method truncate!(confirm: false)
99
+ # Shortcut to truncate the index
100
+ # @param confirm
101
+ # @return [Boolean] acknowledged status
102
+
103
+ # @!method mappings
104
+ # Shortcut for mappings
105
+ # @return [Hash]
106
+
107
+ # @!method metas
108
+ # Shortcut for metas
109
+ # @return [Hash]
110
+
111
+ # @!method settings(flat_settings=true)
112
+ # Shortcut for settings
113
+ # @param [Boolean] flat_settings (default: true)
114
+ # @return [Hash]
115
+
116
+ # @!method aliases
117
+ # Shortcut for aliases
118
+ # @return [Hash]
119
+
120
+ # @!method state
121
+ # Shortcut for state
122
+ # @return [Hash]
123
+
124
+ # @!method schema(features=[])
125
+ # Shortcut for schema
126
+ # @param [Array, Symbol] features
127
+ # @return [Hash]
128
+
129
+ # @!method exists?
130
+ # Shortcut for exists
131
+ # @return [Boolean]
132
+
133
+ # @!method alias_exists?
134
+ # Shortcut for alias_exists
135
+ # @return [Boolean]
136
+
137
+ # @!method setting_exists?
138
+ # Shortcut for setting_exists
139
+ # @return [Boolean]
140
+
141
+ # @!method mapping_exists?
142
+ # Shortcut for mapping_exists
143
+ # @return [Boolean]
144
+
145
+ # @!method meta_exists?
146
+ # Shortcut for meta_exists
147
+ # @return [Boolean]
148
+
71
149
  # fast insert/update data.
72
150
  #
73
151
  # @example
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -94,10 +94,24 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.0.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard-relative_markdown_links
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0.4'
97
111
  description: 'ElasticsearchRecord is a ActiveRecord adapter and provides similar functionality
98
112
  for Elasticsearch.
99
113
 
100
- '
114
+ '
101
115
  email:
102
116
  - info@ruby-smart.org
103
117
  executables: []
@@ -191,7 +205,7 @@ metadata:
191
205
  source_code_uri: https://github.com/ruby-smart/elasticsearch_record
192
206
  documentation_uri: https://rubydoc.info/gems/elasticsearch_record
193
207
  changelog_uri: https://github.com/ruby-smart/elasticsearch_record/blob/main/docs/CHANGELOG.md
194
- post_install_message:
208
+ post_install_message:
195
209
  rdoc_options: []
196
210
  require_paths:
197
211
  - lib
@@ -206,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
220
  - !ruby/object:Gem::Version
207
221
  version: '0'
208
222
  requirements: []
209
- rubygems_version: 3.1.6
210
- signing_key:
223
+ rubygems_version: 3.3.26
224
+ signing_key:
211
225
  specification_version: 4
212
226
  summary: ActiveRecord adapter for Elasticsearch
213
227
  test_files: []