elasticsearch-rails 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +6 -0
- data/elasticsearch-rails.gemspec +1 -1
- data/lib/elasticsearch/rails/instrumentation/publishers.rb +18 -12
- data/lib/elasticsearch/rails/instrumentation/railtie.rb +5 -1
- data/lib/elasticsearch/rails/lograge.rb +9 -5
- data/lib/elasticsearch/rails/tasks/import.rb +3 -2
- data/lib/elasticsearch/rails/version.rb +1 -1
- data/lib/rails/templates/02-pretty.rb +1 -1
- data/lib/rails/templates/03-expert.rb +1 -1
- metadata +44 -44
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDU0MTUzZDc1NzlhOGYyYzE3ODRlNTlkZGVlMjdkNjAyOTlhZjYzMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 702e99d736daeaca35a28b5c9b0410c22076eee2
|
4
|
+
data.tar.gz: f0bcd67eb479b7eff5b9324ca5b3c646dc6931c9
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWNmYzU2NTFhNzkyMmZhZDU1YzA3ZThlMmZmMzYzZWJlMjU1NWM5MTJkNTUx
|
11
|
-
MzU1OGExYmZjMWZjYjRhZmNjODRhOTllNjg3NzM1NWRmMjRjNjU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzlkMjM5ZjlhMTI4YTM2OTRkOTVjN2IwZmE1MzRhNzk3OWNiZDE1NjI2NTRh
|
14
|
-
YzcyMjVkOTU5ZmI2OThlYWE4NTYzYTVmZjk2OTQxMzZiNjhiNzBiODkyM2Yy
|
15
|
-
YzMyYWU5ZjIxOWI2YjNkNTRkN2IxNTI0NDQyMGI2NmY4ZGQ5MTk=
|
6
|
+
metadata.gz: 8191b30a62f1f5dffa9d4efa6b0a0c1b08beb9992f8cc52036c427886f7da1ff51e191a8e39df62e5f29c63d0495c47860d7c2724050a119eb7534adf2f0c08a
|
7
|
+
data.tar.gz: 91710af6b69d1bf1360b01994949f7e6cb5515006cb78242c9986bf66c7acc69a943563d841dec322d7cc4a93e556ec9f809441318f6501e7e7f073f836fe887
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.1.6
|
2
|
+
|
3
|
+
* Fixed errors in templates for the Rails example applications
|
4
|
+
* Fixed errors in the importing Rake task
|
5
|
+
* Refactored and updated the instrumentation support to allow integration with `Persistence::Model`
|
6
|
+
|
1
7
|
## 0.1.5
|
2
8
|
|
3
9
|
* Fixed an exception when no suggestions were returned in the `03-expert` example application template
|
data/elasticsearch-rails.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
|
35
35
|
s.add_development_dependency "lograge"
|
36
36
|
|
37
|
-
s.add_development_dependency "minitest", "~> 4"
|
37
|
+
s.add_development_dependency "minitest", "~> 4.2"
|
38
38
|
s.add_development_dependency "test-unit" if defined?(RUBY_VERSION) && RUBY_VERSION > '2.2'
|
39
39
|
s.add_development_dependency "shoulda-context"
|
40
40
|
s.add_development_dependency "mocha"
|
@@ -9,22 +9,28 @@ module Elasticsearch
|
|
9
9
|
# @see http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
|
10
10
|
#
|
11
11
|
module SearchRequest
|
12
|
-
extend ActiveSupport::Concern
|
13
12
|
|
14
|
-
included
|
15
|
-
|
16
|
-
|
13
|
+
def self.included(base)
|
14
|
+
base.class_eval do
|
15
|
+
alias_method :execute_without_instrumentation!, :execute!
|
16
|
+
|
17
|
+
def execute!
|
18
|
+
execute_with_instrumentation!
|
19
|
+
end
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
# Wrap `Search#execute!` and perform instrumentation
|
22
|
+
#
|
23
|
+
def execute_with_instrumentation!
|
24
|
+
ActiveSupport::Notifications.instrument "search.elasticsearch",
|
25
|
+
name: 'Search',
|
26
|
+
klass: (self.klass.is_a?(Elasticsearch::Model::Proxy::ClassMethodsProxy) ? self.klass.target.to_s : self.klass.to_s),
|
27
|
+
search: self.definition do
|
28
|
+
execute_without_instrumentation!
|
29
|
+
end
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
33
|
+
|
28
34
|
end
|
29
35
|
end
|
30
36
|
end
|
@@ -14,7 +14,11 @@ module Elasticsearch
|
|
14
14
|
|
15
15
|
Elasticsearch::Model::Searching::SearchRequest.class_eval do
|
16
16
|
include Elasticsearch::Rails::Instrumentation::Publishers::SearchRequest
|
17
|
-
end
|
17
|
+
end if defined?(Elasticsearch::Model::Searching::SearchRequest)
|
18
|
+
|
19
|
+
Elasticsearch::Persistence::Model::Find::SearchRequest.class_eval do
|
20
|
+
include Elasticsearch::Rails::Instrumentation::Publishers::SearchRequest
|
21
|
+
end if defined?(Elasticsearch::Persistence::Model::Find::SearchRequest)
|
18
22
|
|
19
23
|
ActiveSupport.on_load(:action_controller) do
|
20
24
|
include Elasticsearch::Rails::Instrumentation::ControllerRuntime
|
@@ -21,17 +21,21 @@ module Elasticsearch
|
|
21
21
|
require 'elasticsearch/rails/instrumentation/log_subscriber'
|
22
22
|
require 'elasticsearch/rails/instrumentation/controller_runtime'
|
23
23
|
|
24
|
-
config.lograge.custom_options = lambda do |event|
|
25
|
-
{ es: event.payload[:elasticsearch_runtime].to_f.round(2) }
|
26
|
-
end
|
27
|
-
|
28
24
|
Elasticsearch::Model::Searching::SearchRequest.class_eval do
|
29
25
|
include Elasticsearch::Rails::Instrumentation::Publishers::SearchRequest
|
30
|
-
end
|
26
|
+
end if defined?(Elasticsearch::Model::Searching::SearchRequest)
|
27
|
+
|
28
|
+
Elasticsearch::Persistence::Model::Find::SearchRequest.class_eval do
|
29
|
+
include Elasticsearch::Rails::Instrumentation::Publishers::SearchRequest
|
30
|
+
end if defined?(Elasticsearch::Persistence::Model::Find::SearchRequest)
|
31
31
|
|
32
32
|
ActiveSupport.on_load(:action_controller) do
|
33
33
|
include Elasticsearch::Rails::Instrumentation::ControllerRuntime
|
34
34
|
end
|
35
|
+
|
36
|
+
config.lograge.custom_options = lambda do |event|
|
37
|
+
{ es: event.payload[:elasticsearch_runtime].to_f.round(2) }
|
38
|
+
end
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
@@ -22,7 +22,7 @@ namespace :elasticsearch do
|
|
22
22
|
task :import => 'import:model'
|
23
23
|
|
24
24
|
namespace :import do
|
25
|
-
|
25
|
+
import_model_desc = <<-DESC.gsub(/ /, '')
|
26
26
|
Import data from your model (pass name as CLASS environment variable).
|
27
27
|
|
28
28
|
$ rake environment elasticsearch:import:model CLASS='MyModel'
|
@@ -39,6 +39,7 @@ namespace :elasticsearch do
|
|
39
39
|
Pass an ActiveRecord scope to limit the imported records:
|
40
40
|
$ rake environment elasticsearch:import:model CLASS='Article' SCOPE='published'
|
41
41
|
DESC
|
42
|
+
desc import_model_desc
|
42
43
|
task :model do
|
43
44
|
if ENV['CLASS'].to_s == ''
|
44
45
|
puts '='*90, 'USAGE', '='*90, import_model_desc, ""
|
@@ -59,7 +60,7 @@ namespace :elasticsearch do
|
|
59
60
|
rescue NoMethodError; end
|
60
61
|
end
|
61
62
|
|
62
|
-
total_errors = klass.import force: ENV.fetch('FORCE', false),
|
63
|
+
total_errors = klass.__elasticsearch__.import force: ENV.fetch('FORCE', false),
|
63
64
|
batch_size: ENV.fetch('BATCH', 1000).to_i,
|
64
65
|
index: ENV.fetch('INDEX', nil),
|
65
66
|
type: ENV.fetch('TYPE', nil),
|
@@ -218,7 +218,7 @@ insert_into_file 'app/views/articles/index.html.erb', after: '</table>' do
|
|
218
218
|
CODE
|
219
219
|
end
|
220
220
|
|
221
|
-
generate "kaminari:views", "
|
221
|
+
generate "kaminari:views", "bootstrap2", "--force"
|
222
222
|
|
223
223
|
gsub_file 'app/views/kaminari/_paginator.html.erb', %r{<ul>}, '<ul class="pagination">'
|
224
224
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# $ rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/03-
|
1
|
+
# $ rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/03-expert.rb
|
2
2
|
|
3
3
|
# (See: 01-basic.rb, 02-pretty.rb)
|
4
4
|
|
metadata
CHANGED
@@ -1,265 +1,265 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: elasticsearch-extensions
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: elasticsearch-model
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
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
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: oj
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
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
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: lograge
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '4'
|
117
|
+
version: '4.2'
|
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: '4'
|
124
|
+
version: '4.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: shoulda-context
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: mocha
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: turn
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
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
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: ruby-prof
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: pry
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: ci_reporter
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - ~>
|
213
|
+
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '1.9'
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - ~>
|
220
|
+
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.9'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: simplecov
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: cane
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- -
|
241
|
+
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
|
-
- -
|
248
|
+
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: require-prof
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
254
254
|
requirements:
|
255
|
-
- -
|
255
|
+
- - ">="
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: '0'
|
258
258
|
type: :development
|
259
259
|
prerelease: false
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
|
-
- -
|
262
|
+
- - ">="
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
description: Ruby on Rails integrations for Elasticsearch.
|
@@ -271,7 +271,7 @@ extra_rdoc_files:
|
|
271
271
|
- README.md
|
272
272
|
- LICENSE.txt
|
273
273
|
files:
|
274
|
-
- .gitignore
|
274
|
+
- ".gitignore"
|
275
275
|
- CHANGELOG.md
|
276
276
|
- Gemfile
|
277
277
|
- LICENSE.txt
|
@@ -305,17 +305,17 @@ licenses:
|
|
305
305
|
metadata: {}
|
306
306
|
post_install_message:
|
307
307
|
rdoc_options:
|
308
|
-
- --charset=UTF-8
|
308
|
+
- "--charset=UTF-8"
|
309
309
|
require_paths:
|
310
310
|
- lib
|
311
311
|
required_ruby_version: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
|
-
- -
|
313
|
+
- - ">="
|
314
314
|
- !ruby/object:Gem::Version
|
315
315
|
version: 1.9.3
|
316
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
317
|
requirements:
|
318
|
-
- -
|
318
|
+
- - ">="
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: '0'
|
321
321
|
requirements: []
|