stretchy-model 0.5.0 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/containers/Dockerfile.opensearch +4 -3
  3. data/docker-compose.yml +32 -19
  4. data/lib/elasticsearch/api/actions/machine_learning/models/delete_model.rb +33 -0
  5. data/lib/elasticsearch/api/actions/machine_learning/models/deploy.rb +31 -0
  6. data/lib/elasticsearch/api/actions/machine_learning/models/get_model.rb +43 -0
  7. data/lib/elasticsearch/api/actions/machine_learning/models/get_status.rb +31 -0
  8. data/lib/elasticsearch/api/actions/machine_learning/models/params_registry.rb +45 -0
  9. data/lib/elasticsearch/api/actions/machine_learning/models/register.rb +45 -0
  10. data/lib/elasticsearch/api/actions/machine_learning/models/undeploy.rb +32 -0
  11. data/lib/elasticsearch/api/actions/machine_learning/models/update_model.rb +39 -0
  12. data/lib/elasticsearch/api/namespace/machine_learning/model.rb +27 -0
  13. data/lib/opensearch/api/actions/machine_learning/models/delete_model.rb +33 -0
  14. data/lib/opensearch/api/actions/machine_learning/models/deploy.rb +31 -0
  15. data/lib/opensearch/api/actions/machine_learning/models/get_model.rb +44 -0
  16. data/lib/opensearch/api/actions/machine_learning/models/get_status.rb +31 -0
  17. data/lib/opensearch/api/actions/machine_learning/models/params_registry.rb +45 -0
  18. data/lib/opensearch/api/actions/machine_learning/models/register.rb +45 -0
  19. data/lib/opensearch/api/actions/machine_learning/models/undeploy.rb +31 -0
  20. data/lib/opensearch/api/actions/machine_learning/models/update_model.rb +39 -0
  21. data/lib/opensearch/api/namespace/machine_learning/model.rb +27 -0
  22. data/lib/stretchy/associations.rb +1 -1
  23. data/lib/stretchy/attributes/type/array.rb +16 -11
  24. data/lib/stretchy/attributes/type/base.rb +42 -0
  25. data/lib/stretchy/attributes/type/binary.rb +45 -0
  26. data/lib/stretchy/attributes/type/boolean.rb +48 -0
  27. data/lib/stretchy/attributes/type/completion.rb +25 -0
  28. data/lib/stretchy/attributes/type/constant_keyword.rb +38 -0
  29. data/lib/stretchy/attributes/type/date_time.rb +85 -0
  30. data/lib/stretchy/attributes/type/dense_vector.rb +59 -0
  31. data/lib/stretchy/attributes/type/flattened.rb +31 -0
  32. data/lib/stretchy/attributes/type/geo_point.rb +27 -0
  33. data/lib/stretchy/attributes/type/geo_shape.rb +27 -0
  34. data/lib/stretchy/attributes/type/hash.rb +36 -13
  35. data/lib/stretchy/attributes/type/histogram.rb +7 -0
  36. data/lib/stretchy/attributes/type/ip.rb +29 -0
  37. data/lib/stretchy/attributes/type/join.rb +22 -0
  38. data/lib/stretchy/attributes/type/keyword.rb +36 -10
  39. data/lib/stretchy/attributes/type/match_only_text.rb +8 -0
  40. data/lib/stretchy/attributes/type/nested.rb +25 -0
  41. data/lib/stretchy/attributes/type/numeric/base.rb +32 -0
  42. data/lib/stretchy/attributes/type/numeric/byte.rb +7 -0
  43. data/lib/stretchy/attributes/type/numeric/double.rb +7 -0
  44. data/lib/stretchy/attributes/type/numeric/float.rb +7 -0
  45. data/lib/stretchy/attributes/type/numeric/half_float.rb +7 -0
  46. data/lib/stretchy/attributes/type/numeric/integer.rb +7 -0
  47. data/lib/stretchy/attributes/type/numeric/long.rb +7 -0
  48. data/lib/stretchy/attributes/type/numeric/scaled_float.rb +23 -0
  49. data/lib/stretchy/attributes/type/numeric/short.rb +7 -0
  50. data/lib/stretchy/attributes/type/numeric/unsigned_long.rb +7 -0
  51. data/lib/stretchy/attributes/type/percolator.rb +23 -0
  52. data/lib/stretchy/attributes/type/point.rb +24 -0
  53. data/lib/stretchy/attributes/type/range/base.rb +9 -0
  54. data/lib/stretchy/attributes/type/range/date_range.rb +17 -0
  55. data/lib/stretchy/attributes/type/range/double_range.rb +17 -0
  56. data/lib/stretchy/attributes/type/range/float_range.rb +16 -0
  57. data/lib/stretchy/attributes/type/range/integer_range.rb +16 -0
  58. data/lib/stretchy/attributes/type/range/ip_range.rb +16 -0
  59. data/lib/stretchy/attributes/type/range/long_range.rb +16 -0
  60. data/lib/stretchy/attributes/type/rank_feature.rb +21 -0
  61. data/lib/stretchy/attributes/type/rank_features.rb +34 -0
  62. data/lib/stretchy/attributes/type/search_as_you_type.rb +30 -0
  63. data/lib/stretchy/attributes/type/shape.rb +24 -0
  64. data/lib/stretchy/attributes/type/sparse_vector.rb +37 -0
  65. data/lib/stretchy/attributes/type/string.rb +7 -0
  66. data/lib/stretchy/attributes/type/text.rb +50 -11
  67. data/lib/stretchy/attributes/type/token_count.rb +26 -0
  68. data/lib/stretchy/attributes/type/version.rb +21 -0
  69. data/lib/stretchy/attributes/type/wildcard.rb +35 -0
  70. data/lib/stretchy/attributes.rb +47 -0
  71. data/lib/stretchy/common.rb +8 -2
  72. data/lib/stretchy/delegation/gateway_delegation.rb +9 -5
  73. data/lib/stretchy/machine_learning/model.rb +192 -0
  74. data/lib/stretchy/open_search_compatibility.rb +4 -0
  75. data/lib/stretchy/pipeline.rb +123 -0
  76. data/lib/stretchy/pipelines/processor.rb +55 -0
  77. data/lib/stretchy/querying.rb +4 -3
  78. data/lib/stretchy/rails/instrumentation/publishers.rb +31 -0
  79. data/lib/{rails → stretchy/rails}/instrumentation/railtie.rb +12 -5
  80. data/lib/stretchy/record.rb +1 -1
  81. data/lib/stretchy/relation.rb +2 -1
  82. data/lib/stretchy/relations/finder_methods.rb +19 -2
  83. data/lib/stretchy/relations/query_builder.rb +80 -4
  84. data/lib/stretchy/relations/query_methods.rb +32 -0
  85. data/lib/stretchy/scoping/named.rb +1 -1
  86. data/lib/stretchy/shared_scopes.rb +6 -1
  87. data/lib/stretchy/version.rb +1 -1
  88. data/lib/stretchy.rb +12 -3
  89. metadata +83 -5
  90. data/lib/rails/instrumentation/publishers.rb +0 -29
@@ -30,7 +30,7 @@ module Stretchy
30
30
  extend Stretchy::Querying
31
31
 
32
32
  # Set up common attributes
33
- attribute :id, :string #, default: lambda { SecureRandom.uuid }
33
+ attribute :id, :keyword #, default: lambda { SecureRandom.uuid }
34
34
  attribute :created_at, :datetime, default: lambda { Time.now.utc }
35
35
  attribute :updated_at, :datetime, default: lambda { Time.now.utc }
36
36
 
@@ -28,7 +28,7 @@ module Stretchy
28
28
  # @param values [Hash] The initial values for the relation.
29
29
  def initialize(klass, values={})
30
30
  @klass = klass
31
- @values = values
31
+ @values = values.merge(default_size: klass.default_size)
32
32
  @offsets = {}
33
33
  @loaded = false
34
34
  end
@@ -147,6 +147,7 @@ module Stretchy
147
147
  "#<#{self.class.name} #{message.join(', ')}>"
148
148
  rescue StandardError => e
149
149
  e
150
+ raise e
150
151
  end
151
152
  end
152
153
 
@@ -39,14 +39,31 @@ module Stretchy
39
39
  self
40
40
  end
41
41
 
42
+ # size is not permitted to the count API but queries are.
43
+ #
44
+ # if a query is supplied with `.count` then the user wants a count of the results
45
+ # matching the query
46
+ #
47
+ # however, the default_size is used to limit the number of results returned
48
+ # so we remove the size from the query and then call `.count` API
49
+ #
50
+ # but if the user supplies a limit, then we should assume they want a count of the results
51
+ # which could lead to some confusion
52
+ # suppose the user calls `.size(100).count` and the default_size is 100
53
+ # if we remove size from the query, then the count could be greater than 100
54
+ #
55
+ # I think the best way to handle this is to remove the size from the query only if it was
56
+ # applied by the default_size
57
+ # If the user supplies a limit, then we should assume they want a count of the results
58
+ #
59
+ # if size is called with a limit,
42
60
  def count
43
- return results.count if @loaded
61
+ return results.count if @loaded || @values[:size].present?
44
62
  spawn.count!
45
63
  end
46
64
 
47
65
  def count!
48
66
  @values[:count] = true
49
- @values.delete(:size)
50
67
  spawned = spawn
51
68
  spawned.order_values.clear
52
69
  spawned.results
@@ -2,11 +2,12 @@ module Stretchy
2
2
  module Relations
3
3
  class QueryBuilder
4
4
 
5
- attr_reader :structure, :values, :attribute_types
5
+ attr_reader :structure, :values, :attribute_types, :default_size
6
6
 
7
7
  def initialize(values, attribute_types = nil)
8
8
  @attribute_types = attribute_types
9
9
  @structure = Jbuilder.new ignore_nil: true
10
+ @default_size = values.delete(:default_size)
10
11
  @values = values
11
12
  end
12
13
 
@@ -30,6 +31,18 @@ module Stretchy
30
31
  @query_string ||= compact_where(values[:query_string], bool: false)
31
32
  end
32
33
 
34
+ def neural_sparse
35
+ @neural_sparse ||= values[:neural_sparse]
36
+ end
37
+
38
+ def neural
39
+ @neural ||= values[:neural]
40
+ end
41
+
42
+ def hybrid
43
+ @hybrid ||= values[:hybrid]
44
+ end
45
+
33
46
  def must_nots
34
47
  @must_nots ||= compact_where(values[:must_not])
35
48
  end
@@ -103,9 +116,68 @@ module Stretchy
103
116
  query_filters.nil? && or_filters.nil?
104
117
  end
105
118
 
119
+ def missing_neural?
120
+ neural_sparse.nil? && neural.nil? && hybrid.nil?
121
+ end
122
+
123
+ def no_query?
124
+ missing_bool_query? && missing_query_string? && missing_query_filter? && missing_neural?
125
+ end
126
+
106
127
  def build_query
107
- return if missing_bool_query? && missing_query_string? && missing_query_filter?
128
+ return if no_query?
108
129
  structure.query do
130
+
131
+ structure.hybrid do
132
+ structure.queries do
133
+ hybrid[:neural].each do |n|
134
+ structure.child! do
135
+ params = n.dup
136
+ field_name, query_text = params.shift
137
+ structure.neural do
138
+ structure.set! field_name do
139
+ structure.query_text query_text
140
+ structure.extract! params, *params.keys
141
+ end
142
+ end
143
+ end
144
+ end
145
+
146
+ hybrid[:query].each do |query|
147
+ structure.child! do
148
+ structure.extract! query, *query.keys
149
+ end
150
+ end
151
+
152
+ end
153
+ end unless hybrid.nil?
154
+
155
+ structure.neural_sparse do
156
+ neural_sparse.each do |args|
157
+ params = args.dup
158
+ field_name, query_text = params.shift
159
+ structure.set! field_name do
160
+ structure.query_text query_text
161
+ structure.extract! params, *params.keys
162
+ end
163
+ end
164
+ end unless neural_sparse.blank?
165
+
166
+ structure.neural do
167
+ neural.each do |args|
168
+ params = args.dup
169
+ field_name, query = params.shift
170
+ structure.set! field_name do
171
+ if query.is_a?(Hash)
172
+ structure.extract! query, *query.keys
173
+ else
174
+ structure.query_text query
175
+ end
176
+ structure.extract! params, *params.keys
177
+ end
178
+ end
179
+ end unless neural.blank?
180
+
109
181
  structure.regexp do
110
182
  build_regexp unless regexes.nil?
111
183
  end
@@ -120,12 +192,11 @@ module Stretchy
120
192
 
121
193
  end unless missing_bool_query? && missing_query_filter?
122
194
 
123
-
124
-
125
195
  structure.query_string do
126
196
  structure.extract! query_string_options, *query_string_options.keys
127
197
  structure.query query_strings
128
198
  end unless query_strings.nil?
199
+
129
200
  end.with_indifferent_access
130
201
  end
131
202
 
@@ -208,6 +279,11 @@ module Stretchy
208
279
  end
209
280
 
210
281
  def extra_search_options
282
+ unless self.count?
283
+ values[:size] = size.present? ? size : values[:default_size]
284
+ else
285
+ values[:size] = nil
286
+ end
211
287
  [:size].inject(Hash.new) { |h,k| h[k] = self.send(k) unless self.send(k).nil?; h}
212
288
  end
213
289
 
@@ -19,6 +19,9 @@ module Stretchy
19
19
  :or_filter,
20
20
  :extending,
21
21
  :skip_callbacks,
22
+ :neural_sparse,
23
+ :neural,
24
+ :hybrid,
22
25
  :regexp
23
26
  ]
24
27
 
@@ -231,6 +234,35 @@ module Stretchy
231
234
  # @see #where
232
235
  alias :must :where
233
236
 
237
+
238
+ concerning :Neural do
239
+ def neural_sparse(opts)
240
+ spawn.neural_sparse!(opts)
241
+ end
242
+
243
+ def neural_sparse!(opts) # :nodoc:
244
+ self.neural_sparse_values += [opts]
245
+ self
246
+ end
247
+
248
+ def neural(opts)
249
+ spawn.neural!(opts)
250
+ end
251
+
252
+ def neural!(opts) # :nodoc:
253
+ self.neural_values += [opts]
254
+ self
255
+ end
256
+
257
+ def hybrid(opts)
258
+ spawn.hybrid!(opts)
259
+ end
260
+
261
+ def hybrid!(opts) # :nodoc:
262
+ self.hybrid_values += [opts]
263
+ self
264
+ end
265
+ end
234
266
  # Adds a regexp condition to the query.
235
267
  #
236
268
  # @param field [Hash] the field to filter by and the Regexp to match
@@ -8,7 +8,7 @@ module Stretchy
8
8
  if current_scope
9
9
  current_scope.clone
10
10
  else
11
- default_scoped.size(default_size)
11
+ default_scoped
12
12
  end
13
13
  end
14
14
 
@@ -4,7 +4,12 @@ module Stretchy
4
4
 
5
5
  included do
6
6
 
7
- scope :between, ->(range, range_field = "created_at") { filter_query(:range, range_field => {gte: range.begin, lte: range.end}) }
7
+ scope :between, ->(range, range_field = "created_at") do
8
+ range_options = {gte: range.begin}
9
+ upper_bound = range.exclude_end? ? :lt : :lte
10
+ range_options[upper_bound] = range.end
11
+ filter_query(:range, range_field => range_options)
12
+ end
8
13
  scope :using_time_based_indices, lambda { |range| search_options(index: time_based_indices(range)) }
9
14
 
10
15
  end
@@ -1,3 +1,3 @@
1
1
  module Stretchy
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.5'
3
3
  end
data/lib/stretchy.rb CHANGED
@@ -9,9 +9,8 @@ require 'active_model'
9
9
  require 'active_support/all'
10
10
 
11
11
  require_relative "stretchy/version"
12
- require_relative "rails/instrumentation/railtie" if defined?(Rails)
13
-
14
-
12
+ require_relative "stretchy/rails/instrumentation/railtie" if defined?(Rails)
13
+ require_relative 'elasticsearch/api/namespace/machine_learning/model'
15
14
 
16
15
  module Stretchy
17
16
 
@@ -21,15 +20,21 @@ module Stretchy
21
20
  loader.tag = File.basename(__FILE__, ".rb")
22
21
  loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
23
22
  loader.push_dir(__dir__)
23
+ loader.inflector.inflect("ip" => "IP")
24
24
  loader
25
25
  end
26
26
  end
27
27
 
28
28
  def self.boot!
29
29
  loader.setup
30
+ Elasticsearch::API.send(:include, Elasticsearch::API::MachineLearning::Models)
30
31
  Stretchy::Attributes.register!
31
32
  end
32
33
 
34
+ def self.instrument!
35
+ Stretchy::Delegation::GatewayDelegation.send(:include, Rails::Instrumentation::Publishers::Record)
36
+ end
37
+
33
38
  module Errors
34
39
  class QueryOptionMissing < StandardError; end
35
40
  end
@@ -49,6 +54,10 @@ module Stretchy
49
54
  self.opensearch = true if @client.class.name =~ /OpenSearch/
50
55
  end
51
56
 
57
+ def search_backend_const
58
+ @opensearch ? OpenSearch : Elasticsearch
59
+ end
60
+
52
61
  def opensearch=(bool)
53
62
  @opensearch = bool
54
63
  OpenSearchCompatibility.opensearch_patch! if bool
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stretchy-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spencer Markowski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-14 00:00:00.000000000 Z
11
+ date: 2024-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 0.5.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: faker
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '2.18'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '2.18'
209
223
  description: Provides a familiar ActiveRecord-like interface for working with Elasticsearch
210
224
  email:
211
225
  - spencer.markowski@theablefew.com
@@ -224,8 +238,24 @@ files:
224
238
  - containers/Dockerfile.elasticsearch
225
239
  - containers/Dockerfile.opensearch
226
240
  - docker-compose.yml
227
- - lib/rails/instrumentation/publishers.rb
228
- - lib/rails/instrumentation/railtie.rb
241
+ - lib/elasticsearch/api/actions/machine_learning/models/delete_model.rb
242
+ - lib/elasticsearch/api/actions/machine_learning/models/deploy.rb
243
+ - lib/elasticsearch/api/actions/machine_learning/models/get_model.rb
244
+ - lib/elasticsearch/api/actions/machine_learning/models/get_status.rb
245
+ - lib/elasticsearch/api/actions/machine_learning/models/params_registry.rb
246
+ - lib/elasticsearch/api/actions/machine_learning/models/register.rb
247
+ - lib/elasticsearch/api/actions/machine_learning/models/undeploy.rb
248
+ - lib/elasticsearch/api/actions/machine_learning/models/update_model.rb
249
+ - lib/elasticsearch/api/namespace/machine_learning/model.rb
250
+ - lib/opensearch/api/actions/machine_learning/models/delete_model.rb
251
+ - lib/opensearch/api/actions/machine_learning/models/deploy.rb
252
+ - lib/opensearch/api/actions/machine_learning/models/get_model.rb
253
+ - lib/opensearch/api/actions/machine_learning/models/get_status.rb
254
+ - lib/opensearch/api/actions/machine_learning/models/params_registry.rb
255
+ - lib/opensearch/api/actions/machine_learning/models/register.rb
256
+ - lib/opensearch/api/actions/machine_learning/models/undeploy.rb
257
+ - lib/opensearch/api/actions/machine_learning/models/update_model.rb
258
+ - lib/opensearch/api/namespace/machine_learning/model.rb
229
259
  - lib/stretchy.rb
230
260
  - lib/stretchy/associations.rb
231
261
  - lib/stretchy/associations/associated_validator.rb
@@ -233,19 +263,67 @@ files:
233
263
  - lib/stretchy/attributes.rb
234
264
  - lib/stretchy/attributes/transformers/keyword_transformer.rb
235
265
  - lib/stretchy/attributes/type/array.rb
266
+ - lib/stretchy/attributes/type/base.rb
267
+ - lib/stretchy/attributes/type/binary.rb
268
+ - lib/stretchy/attributes/type/boolean.rb
269
+ - lib/stretchy/attributes/type/completion.rb
270
+ - lib/stretchy/attributes/type/constant_keyword.rb
271
+ - lib/stretchy/attributes/type/date_time.rb
272
+ - lib/stretchy/attributes/type/dense_vector.rb
273
+ - lib/stretchy/attributes/type/flattened.rb
274
+ - lib/stretchy/attributes/type/geo_point.rb
275
+ - lib/stretchy/attributes/type/geo_shape.rb
236
276
  - lib/stretchy/attributes/type/hash.rb
277
+ - lib/stretchy/attributes/type/histogram.rb
278
+ - lib/stretchy/attributes/type/ip.rb
279
+ - lib/stretchy/attributes/type/join.rb
237
280
  - lib/stretchy/attributes/type/keyword.rb
281
+ - lib/stretchy/attributes/type/match_only_text.rb
282
+ - lib/stretchy/attributes/type/nested.rb
283
+ - lib/stretchy/attributes/type/numeric/base.rb
284
+ - lib/stretchy/attributes/type/numeric/byte.rb
285
+ - lib/stretchy/attributes/type/numeric/double.rb
286
+ - lib/stretchy/attributes/type/numeric/float.rb
287
+ - lib/stretchy/attributes/type/numeric/half_float.rb
288
+ - lib/stretchy/attributes/type/numeric/integer.rb
289
+ - lib/stretchy/attributes/type/numeric/long.rb
290
+ - lib/stretchy/attributes/type/numeric/scaled_float.rb
291
+ - lib/stretchy/attributes/type/numeric/short.rb
292
+ - lib/stretchy/attributes/type/numeric/unsigned_long.rb
293
+ - lib/stretchy/attributes/type/percolator.rb
294
+ - lib/stretchy/attributes/type/point.rb
295
+ - lib/stretchy/attributes/type/range/base.rb
296
+ - lib/stretchy/attributes/type/range/date_range.rb
297
+ - lib/stretchy/attributes/type/range/double_range.rb
298
+ - lib/stretchy/attributes/type/range/float_range.rb
299
+ - lib/stretchy/attributes/type/range/integer_range.rb
300
+ - lib/stretchy/attributes/type/range/ip_range.rb
301
+ - lib/stretchy/attributes/type/range/long_range.rb
302
+ - lib/stretchy/attributes/type/rank_feature.rb
303
+ - lib/stretchy/attributes/type/rank_features.rb
304
+ - lib/stretchy/attributes/type/search_as_you_type.rb
305
+ - lib/stretchy/attributes/type/shape.rb
306
+ - lib/stretchy/attributes/type/sparse_vector.rb
307
+ - lib/stretchy/attributes/type/string.rb
238
308
  - lib/stretchy/attributes/type/text.rb
309
+ - lib/stretchy/attributes/type/token_count.rb
310
+ - lib/stretchy/attributes/type/version.rb
311
+ - lib/stretchy/attributes/type/wildcard.rb
239
312
  - lib/stretchy/common.rb
240
313
  - lib/stretchy/delegation/delegate_cache.rb
241
314
  - lib/stretchy/delegation/gateway_delegation.rb
242
315
  - lib/stretchy/indexing/bulk.rb
316
+ - lib/stretchy/machine_learning/model.rb
243
317
  - lib/stretchy/model/callbacks.rb
244
318
  - lib/stretchy/model/serialization.rb
245
319
  - lib/stretchy/null_relation.rb
246
320
  - lib/stretchy/open_search_compatibility.rb
247
321
  - lib/stretchy/persistence.rb
322
+ - lib/stretchy/pipeline.rb
323
+ - lib/stretchy/pipelines/processor.rb
248
324
  - lib/stretchy/querying.rb
325
+ - lib/stretchy/rails/instrumentation/publishers.rb
326
+ - lib/stretchy/rails/instrumentation/railtie.rb
249
327
  - lib/stretchy/record.rb
250
328
  - lib/stretchy/refreshable.rb
251
329
  - lib/stretchy/relation.rb
@@ -291,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
369
  - !ruby/object:Gem::Version
292
370
  version: '0'
293
371
  requirements: []
294
- rubygems_version: 3.5.3
372
+ rubygems_version: 3.3.7
295
373
  signing_key:
296
374
  specification_version: 4
297
375
  summary: Rails ORM for Elasticsearch
@@ -1,29 +0,0 @@
1
- module Rails
2
- module Instrumentation
3
- module Publishers
4
-
5
- module Record
6
-
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- unless method_defined?(:search_without_instrumentation!)
11
- alias_method :search_without_instrumentation!, :search
12
- alias_method :search, :search_with_instrumentation!
13
- end
14
- end
15
-
16
- def search_with_instrumentation!(query_or_definition, options={})
17
- ActiveSupport::Notifications.instrument "search.stretchy",
18
- name: "Search",
19
- klass: self.base_class.to_s,
20
- search: {index: self.index_name, body: query_or_definition }.merge(options) do
21
- search_without_instrumentation!(query_or_definition, options)
22
- end
23
- end
24
-
25
- end
26
-
27
- end
28
- end
29
- end