elasticsearch-model 7.1.0 → 7.1.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: 426502b81d368a30ab2644d116674e4c9561d48b10f3539ebf8e41867e33a0e8
4
- data.tar.gz: e6381e268ce9aa3a78db28351e981c9d35a0911c43e78b791c3d61193046ad7f
3
+ metadata.gz: 4301031eeda01ef94c74b9ad4dc6943a248f876408332d79d1215efddab9eef1
4
+ data.tar.gz: 7b180c808882ae6539ecc42abe550138fd55b79a1548230529dbd0ddc6af30a4
5
5
  SHA512:
6
- metadata.gz: 46a12cf02fec9ae0435f65d228c30626363bc2df21fbd79672cbc77f1de47a333a939bad272d2ccad6ada45cec159a93780c44dc5451cde8342caf00d0703f48
7
- data.tar.gz: a05e45b26584cdbbaa6aa97c70ff4cb8a0809d7dd8222c57eacbc52fb2a8ba0abc5503934810e37ae0dd9d36b56a3c37c956f28082a5f47e660b06c61c7dfa03
6
+ metadata.gz: c16dc60e532cbbca544cd234e8897168de3504ced1c9d13a2b7e531a8aaa8e03acf48934f6605dcfb4a35f2e4a32f74a211382302a911411a113d22294b0756a
7
+ data.tar.gz: 28606153ac91b2bfbd472c8727d7764964a793cb4075d9d3b30eb39bb72dda8192020c6e00e2b39e044c36883a1a18cf34c0e5454b939780d3bd9969fe693b53
data/Gemfile CHANGED
@@ -21,6 +21,6 @@ source 'https://rubygems.org'
21
21
  gemspec
22
22
 
23
23
  group :development, :testing do
24
- gem 'rspec'
25
24
  gem 'pry-nav'
25
+ gem 'rspec'
26
26
  end
data/README.md CHANGED
@@ -1,18 +1,14 @@
1
1
  # Elasticsearch::Model
2
2
 
3
- The `elasticsearch-model` library builds on top of the
4
- the [`elasticsearch`](https://github.com/elastic/elasticsearch-ruby) library.
3
+ The `elasticsearch-model` library builds on top of the the [`elasticsearch`](https://github.com/elastic/elasticsearch-ruby) library.
5
4
 
6
- It aims to simplify integration of Ruby classes ("models"), commonly found
7
- e.g. in [Ruby on Rails](http://rubyonrails.org) applications, with the
8
- [Elasticsearch](https://www.elastic.co) search and analytics engine.
5
+ It aims to simplify integration of Ruby classes ("models"), commonly found e.g. in [Ruby on Rails](http://rubyonrails.org) applications, with the [Elasticsearch](https://www.elastic.co) search and analytics engine.
9
6
 
10
7
  ## Compatibility
11
8
 
12
- This library is compatible with Ruby 1.9.3 and higher.
9
+ This library is compatible with Ruby 2.4 and higher.
13
10
 
14
- The library version numbers follow the Elasticsearch major versions, and the `master` branch
15
- is compatible with the Elasticsearch `master` branch, therefore, with the next major version.
11
+ The library version numbers follow the Elasticsearch major versions. The `master` branch is compatible with the latest Elasticsearch stack stable release.
16
12
 
17
13
  | Rubygem | | Elasticsearch |
18
14
  |:-------------:|:-:| :-----------: |
@@ -20,7 +16,7 @@ is compatible with the Elasticsearch `master` branch, therefore, with the next m
20
16
  | 2.x | → | 2.x |
21
17
  | 5.x | → | 5.x |
22
18
  | 6.x | → | 6.x |
23
- | master | → | master |
19
+ | master | → | 7.x |
24
20
 
25
21
  ## Installation
26
22
 
@@ -73,9 +69,7 @@ This will extend the model with functionality related to Elasticsearch.
73
69
 
74
70
  #### Feature Extraction Pattern
75
71
 
76
- Instead of including the `Elasticsearch::Model` module directly in your model,
77
- you can include it in a "concern" or "trait" module, which is quite common pattern in Rails applications,
78
- using e.g. `ActiveSupport::Concern` as the instrumentation:
72
+ Instead of including the `Elasticsearch::Model` module directly in your model, you can include it in a "concern" or "trait" module, which is quite common pattern in Rails applications, using e.g. `ActiveSupport::Concern` as the instrumentation:
79
73
 
80
74
  ```ruby
81
75
  # In: app/models/concerns/searchable.rb
@@ -290,11 +284,8 @@ NOTE: It is _not_ possible to chain other methods on top of the `records` object
290
284
 
291
285
  #### Pagination
292
286
 
293
- You can implement pagination with the `from` and `size` search parameters. However, search results
294
- can be automatically paginated with the [`kaminari`](http://rubygems.org/gems/kaminari) or
295
- [`will_paginate`](https://github.com/mislav/will_paginate) gems.
296
- (The pagination gems must be added before the Elasticsearch gems in your Gemfile,
297
- or loaded first in your application.)
287
+ You can implement pagination with the `from` and `size` search parameters. However, search results can be automatically paginated with the [`kaminari`](http://rubygems.org/gems/kaminari) or [`will_paginate`](https://github.com/mislav/will_paginate) gems.
288
+ (The pagination gems must be added before the Elasticsearch gems in your Gemfile, or loaded first in your application.)
298
289
 
299
290
  If Kaminari or WillPaginate is loaded, use the familiar paging methods:
300
291
 
@@ -322,8 +313,7 @@ Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model
322
313
 
323
314
  #### The Elasticsearch DSL
324
315
 
325
- In most situations, you'll want to pass the search definition
326
- in the Elasticsearch [domain-specific language](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) to the client:
316
+ In most situations, you'll want to pass the search definition in the Elasticsearch [domain-specific language](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) to the client:
327
317
 
328
318
  ```ruby
329
319
  response = Article.search query: { match: { title: "Fox Dogs" } },
@@ -333,8 +323,7 @@ response.results.first.highlight.title
333
323
  # ["Quick brown <em>fox</em>"]
334
324
  ```
335
325
 
336
- You can pass any object which implements a `to_hash` method, which is called automatically,
337
- so you can use a custom class or your favourite JSON builder to build the search definition:
326
+ You can pass any object which implements a `to_hash` method, which is called automatically, so you can use a custom class or your favourite JSON builder to build the search definition:
338
327
 
339
328
  ```ruby
340
329
  require 'jbuilder'
@@ -354,8 +343,7 @@ response.results.first.title
354
343
  # => "Quick brown fox"
355
344
  ```
356
345
 
357
- Also, you can use the [**`elasticsearch-dsl`**](https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-dsl) library, which provides a specialized Ruby API for
358
- the Elasticsearch Query DSL:
346
+ Also, you can use the [**`elasticsearch-dsl`**](https://github.com/elastic/elasticsearch-ruby/tree/master/elasticsearch-dsl) library, which provides a specialized Ruby API for the Elasticsearch Query DSL:
359
347
 
360
348
  ```ruby
361
349
  require 'elasticsearch/dsl'
data/Rakefile CHANGED
@@ -21,7 +21,9 @@ desc 'Run unit tests'
21
21
  task default: 'test:all'
22
22
  task test: 'test:all'
23
23
 
24
- GEMFILES = ['4.0.gemfile', '5.0.gemfile', '6.0.gemfile']
24
+ gemfiles = ['5.0.gemfile', '6.0.gemfile']
25
+ gemfiles << '4.0.gemfile' if RUBY_VERSION < '2.7'
26
+ GEMFILES = gemfiles.freeze
25
27
 
26
28
  namespace :bundle do
27
29
  desc 'Install dependencies for all the Gemfiles in /gemfiles. Optionally define env variable RAILS_VERSIONS. E.g. RAILS_VERSIONS=3.0,5.0'
@@ -16,56 +16,54 @@
16
16
  # under the License.
17
17
 
18
18
  # coding: utf-8
19
- lib = File.expand_path('../lib', __FILE__)
19
+
20
+ lib = File.expand_path('lib', __dir__)
20
21
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
21
22
  require 'elasticsearch/model/version'
22
23
 
23
24
  Gem::Specification.new do |s|
24
- s.name = "elasticsearch-model"
25
+ s.name = 'elasticsearch-model'
25
26
  s.version = Elasticsearch::Model::VERSION
26
- s.authors = ["Karel Minarik"]
27
- s.email = ["karel.minarik@elasticsearch.org"]
28
- s.description = "ActiveModel/Record integrations for Elasticsearch."
29
- s.summary = "ActiveModel/Record integrations for Elasticsearch."
30
- s.homepage = "https://github.com/elasticsearch/elasticsearch-rails/"
31
- s.license = "Apache 2"
27
+ s.authors = ['Karel Minarik']
28
+ s.email = ['karel.minarik@elasticsearch.org']
29
+ s.description = 'ActiveModel/Record integrations for Elasticsearch.'
30
+ s.summary = 'ActiveModel/Record integrations for Elasticsearch.'
31
+ s.homepage = 'https://github.com/elasticsearch/elasticsearch-rails/'
32
+ s.license = 'Apache 2'
32
33
 
33
34
  s.files = `git ls-files`.split($/)
34
35
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
35
36
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
36
- s.require_paths = ["lib"]
37
-
38
- s.extra_rdoc_files = [ "README.md", "LICENSE.txt" ]
39
- s.rdoc_options = [ "--charset=UTF-8" ]
40
-
41
- s.required_ruby_version = ">= 1.9.3"
42
-
43
- s.add_dependency "elasticsearch", '> 1'
44
- s.add_dependency "activesupport", '> 3'
45
- s.add_dependency "hashie"
46
-
47
- s.add_development_dependency "bundler"
48
- s.add_development_dependency "rake", "~> 12"
49
-
50
- s.add_development_dependency "elasticsearch-extensions"
37
+ s.require_paths = ['lib']
51
38
 
52
- s.add_development_dependency "sqlite3" unless defined?(JRUBY_VERSION)
53
- s.add_development_dependency "activemodel", "> 3"
39
+ s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
40
+ s.rdoc_options = ['--charset=UTF-8']
54
41
 
55
- s.add_development_dependency "oj" unless defined?(JRUBY_VERSION)
56
- s.add_development_dependency "kaminari"
57
- s.add_development_dependency "will_paginate"
42
+ s.required_ruby_version = '>= 2.4'
58
43
 
59
- s.add_development_dependency "minitest"
60
- s.add_development_dependency "test-unit"
61
- s.add_development_dependency "shoulda-context"
62
- s.add_development_dependency "mocha"
63
- s.add_development_dependency "turn"
64
- s.add_development_dependency "yard"
65
- s.add_development_dependency "ruby-prof" unless defined?(JRUBY_VERSION)
66
- s.add_development_dependency "pry"
44
+ s.add_dependency 'activesupport', '> 3'
45
+ s.add_dependency 'elasticsearch', '> 1'
46
+ s.add_dependency 'hashie'
67
47
 
68
- s.add_development_dependency "simplecov"
69
- s.add_development_dependency "cane"
70
- s.add_development_dependency "require-prof"
48
+ s.add_development_dependency 'activemodel', '> 3'
49
+ s.add_development_dependency 'bundler'
50
+ s.add_development_dependency 'cane'
51
+ s.add_development_dependency 'elasticsearch-extensions'
52
+ s.add_development_dependency 'kaminari'
53
+ s.add_development_dependency 'minitest'
54
+ s.add_development_dependency 'mocha'
55
+ s.add_development_dependency 'pry'
56
+ s.add_development_dependency 'rake', '~> 12'
57
+ s.add_development_dependency 'require-prof'
58
+ s.add_development_dependency 'shoulda-context'
59
+ s.add_development_dependency 'simplecov'
60
+ s.add_development_dependency 'test-unit'
61
+ s.add_development_dependency 'turn'
62
+ s.add_development_dependency 'will_paginate'
63
+ s.add_development_dependency 'yard'
64
+ unless defined?(JRUBY_VERSION)
65
+ s.add_development_dependency 'oj'
66
+ s.add_development_dependency 'ruby-prof'
67
+ s.add_development_dependency 'sqlite3'
68
+ end
71
69
  end
@@ -26,10 +26,11 @@ gemspec path: '../'
26
26
 
27
27
  gem 'activemodel', '~> 4'
28
28
  gem 'activerecord', '~> 4'
29
- gem 'sqlite3', '> 1.3', '< 1.4' unless defined?(JRUBY_VERSION)
30
29
  gem 'mongoid', '~> 5'
30
+ gem 'sqlite3', '> 1.3', '< 1.4' unless defined?(JRUBY_VERSION)
31
31
 
32
32
  group :development, :testing do
33
- gem 'rspec'
33
+ gem 'bigdecimal', '~> 1'
34
34
  gem 'pry-nav'
35
- end
35
+ gem 'rspec'
36
+ end
@@ -112,7 +112,7 @@ module Elasticsearch
112
112
  # Delegate common methods to the `__elasticsearch__` ClassMethodsProxy, unless they are defined already
113
113
  class << self
114
114
  METHODS.each do |method|
115
- delegate method, to: :__elasticsearch__ unless self.respond_to?(method)
115
+ delegate method, to: :__elasticsearch__ unless self.public_instance_methods.include?(method)
116
116
  end
117
117
  end
118
118
  end
@@ -102,7 +102,7 @@ module Elasticsearch
102
102
  scope = scope.__send__(named_scope) if named_scope
103
103
  scope = scope.instance_exec(&query) if query
104
104
 
105
- scope.find_in_batches(options) do |batch|
105
+ scope.find_in_batches(**options) do |batch|
106
106
  batch = self.__send__(preprocess, batch) if preprocess
107
107
  yield(batch) if batch.present?
108
108
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Model
20
- VERSION = "7.1.0"
20
+ VERSION = "7.1.1"
21
21
  end
22
22
  end
@@ -48,6 +48,7 @@ describe Elasticsearch::Model do
48
48
  end
49
49
 
50
50
  DummyIncludingModel.__send__ :include, Elasticsearch::Model
51
+ DummyIncludingModelWithSearchMethodDefined.__send__ :include, Elasticsearch::Model
51
52
  end
52
53
 
53
54
  after(:all) do
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: elasticsearch
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: '3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '1'
26
+ version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: elasticsearch
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">"
32
32
  - !ruby/object:Gem::Version
33
- version: '3'
33
+ version: '1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">"
39
39
  - !ruby/object:Gem::Version
40
- version: '3'
40
+ version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashie
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,35 +53,35 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ">"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ">"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '12'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '12'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: elasticsearch-extensions
84
+ name: cane
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: sqlite3
98
+ name: elasticsearch-extensions
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,21 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: activemodel
112
+ name: kaminari
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '3'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '3'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: oj
126
+ name: minitest
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: kaminari
140
+ name: mocha
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: will_paginate
154
+ name: pry
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -165,21 +165,21 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: minitest
168
+ name: rake
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '12'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '12'
181
181
  - !ruby/object:Gem::Dependency
182
- name: test-unit
182
+ name: require-prof
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -207,7 +207,7 @@ dependencies:
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
- name: mocha
210
+ name: simplecov
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
@@ -221,7 +221,7 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: turn
224
+ name: test-unit
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -235,7 +235,7 @@ dependencies:
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  - !ruby/object:Gem::Dependency
238
- name: yard
238
+ name: turn
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - ">="
@@ -249,7 +249,7 @@ dependencies:
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  - !ruby/object:Gem::Dependency
252
- name: ruby-prof
252
+ name: will_paginate
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ">="
@@ -263,7 +263,7 @@ dependencies:
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0'
265
265
  - !ruby/object:Gem::Dependency
266
- name: pry
266
+ name: yard
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">="
@@ -277,7 +277,7 @@ dependencies:
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
279
  - !ruby/object:Gem::Dependency
280
- name: simplecov
280
+ name: oj
281
281
  requirement: !ruby/object:Gem::Requirement
282
282
  requirements:
283
283
  - - ">="
@@ -291,7 +291,7 @@ dependencies:
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0'
293
293
  - !ruby/object:Gem::Dependency
294
- name: cane
294
+ name: ruby-prof
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="
@@ -305,7 +305,7 @@ dependencies:
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0'
307
307
  - !ruby/object:Gem::Dependency
308
- name: require-prof
308
+ name: sqlite3
309
309
  requirement: !ruby/object:Gem::Requirement
310
310
  requirements:
311
311
  - - ">="
@@ -449,7 +449,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
449
449
  requirements:
450
450
  - - ">="
451
451
  - !ruby/object:Gem::Version
452
- version: 1.9.3
452
+ version: '2.4'
453
453
  required_rubygems_version: !ruby/object:Gem::Requirement
454
454
  requirements:
455
455
  - - ">="