chewy 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +43 -11
- data/Appraisals +39 -12
- data/CHANGELOG.md +42 -0
- data/Gemfile +1 -1
- data/README.md +60 -7
- data/chewy.gemspec +12 -5
- data/gemfiles/{rails.4.0.mongoid.gemfile → rails.4.0.mongoid.4.0.0.gemfile} +1 -1
- data/gemfiles/{rails.4.0.mongoid.kaminari.gemfile → rails.4.0.mongoid.4.0.0.kaminari.gemfile} +1 -1
- data/gemfiles/{rails.4.0.mongoid.will_paginate.gemfile → rails.4.0.mongoid.4.0.0.will_paginate.gemfile} +1 -1
- data/gemfiles/rails.4.0.mongoid.5.1.0.gemfile +15 -0
- data/gemfiles/rails.4.0.mongoid.5.1.0.kaminari.gemfile +14 -0
- data/gemfiles/rails.4.0.mongoid.5.1.0.will_paginate.gemfile +14 -0
- data/gemfiles/{rails.4.1.mongoid.gemfile → rails.4.1.mongoid.4.0.0.gemfile} +1 -1
- data/gemfiles/{rails.4.1.mongoid.kaminari.gemfile → rails.4.1.mongoid.4.0.0.kaminari.gemfile} +1 -1
- data/gemfiles/{rails.4.1.mongoid.will_paginate.gemfile → rails.4.1.mongoid.4.0.0.will_paginate.gemfile} +1 -1
- data/gemfiles/rails.4.1.mongoid.5.1.0.gemfile +15 -0
- data/gemfiles/rails.4.1.mongoid.5.1.0.kaminari.gemfile +14 -0
- data/gemfiles/rails.4.1.mongoid.5.1.0.will_paginate.gemfile +14 -0
- data/gemfiles/{rails.4.2.mongoid.gemfile → rails.4.2.mongoid.4.0.0.gemfile} +1 -1
- data/gemfiles/{rails.4.2.mongoid.kaminari.gemfile → rails.4.2.mongoid.4.0.0.kaminari.gemfile} +1 -1
- data/gemfiles/{rails.4.2.mongoid.will_paginate.gemfile → rails.4.2.mongoid.4.0.0.will_paginate.gemfile} +1 -1
- data/gemfiles/rails.4.2.mongoid.5.1.0.gemfile +15 -0
- data/gemfiles/rails.4.2.mongoid.5.1.0.kaminari.gemfile +14 -0
- data/gemfiles/rails.4.2.mongoid.5.1.0.will_paginate.gemfile +14 -0
- data/gemfiles/rails.5.0.0.beta3.activerecord.gemfile +16 -0
- data/gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile +16 -0
- data/gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile +15 -0
- data/gemfiles/{sequel.4.28.gemfile → sequel.4.31.gemfile} +1 -1
- data/lib/chewy.rb +7 -1
- data/lib/chewy/errors.rb +6 -0
- data/lib/chewy/fields/base.rb +12 -8
- data/lib/chewy/fields/root.rb +1 -1
- data/lib/chewy/index.rb +17 -8
- data/lib/chewy/index/actions.rb +4 -4
- data/lib/chewy/query.rb +8 -13
- data/lib/chewy/query/compose.rb +2 -2
- data/lib/chewy/query/criteria.rb +2 -2
- data/lib/chewy/query/loading.rb +1 -1
- data/lib/chewy/query/nodes/bool.rb +1 -1
- data/lib/chewy/query/nodes/regexp.rb +2 -2
- data/lib/chewy/railtie.rb +15 -3
- data/lib/chewy/rake_helper.rb +5 -2
- data/lib/chewy/rspec/update_index.rb +17 -6
- data/lib/chewy/strategy.rb +7 -3
- data/lib/chewy/strategy/active_job.rb +2 -2
- data/lib/chewy/strategy/resque.rb +2 -2
- data/lib/chewy/strategy/sidekiq.rb +2 -2
- data/lib/chewy/type.rb +14 -0
- data/lib/chewy/type/adapter/active_record.rb +11 -1
- data/lib/chewy/type/adapter/orm.rb +13 -11
- data/lib/chewy/type/adapter/sequel.rb +10 -12
- data/lib/chewy/type/import.rb +53 -22
- data/lib/chewy/type/witchcraft.rb +208 -0
- data/lib/chewy/type/wrapper.rb +25 -7
- data/lib/chewy/version.rb +1 -1
- data/lib/tasks/chewy.rake +22 -14
- data/spec/chewy/fields/base_spec.rb +6 -2
- data/spec/chewy/fields/time_fields_spec.rb +4 -4
- data/spec/chewy/index/actions_spec.rb +32 -18
- data/spec/chewy/index_spec.rb +19 -0
- data/spec/chewy/query/pagination_spec.rb +1 -1
- data/spec/chewy/query_spec.rb +77 -21
- data/spec/chewy/rspec/update_index_spec.rb +75 -62
- data/spec/chewy/runtime_spec.rb +1 -1
- data/spec/chewy/strategy/active_job_spec.rb +6 -1
- data/spec/chewy/strategy/atomic_spec.rb +5 -5
- data/spec/chewy/strategy/resque_spec.rb +7 -2
- data/spec/chewy/strategy/sidekiq_spec.rb +6 -1
- data/spec/chewy/strategy_spec.rb +13 -1
- data/spec/chewy/type/actions_spec.rb +4 -1
- data/spec/chewy/type/import_spec.rb +71 -2
- data/spec/chewy/type/observe_spec.rb +9 -9
- data/spec/chewy/type/witchcraft_spec.rb +154 -0
- data/spec/chewy/type/wrapper_spec.rb +30 -5
- data/spec/chewy/type_spec.rb +10 -0
- data/spec/chewy_spec.rb +29 -5
- data/spec/spec_helper.rb +2 -0
- data/spec/support/class_helpers.rb +15 -0
- data/spec/support/mongoid.rb +5 -0
- metadata +64 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f0c4b83cadcf35bdf475f7f68e16120ed4674d
|
4
|
+
data.tar.gz: b9653b8e9bfb3e2e8f8b98662495f13a6b2d56e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c28d1f97d185c70c986c4d7250e566bb196adc2f7230a7ff76939e3cbc589fabcb0a4ac6b26fe80ec267ec6c7d6a80cea766f4ea5fb6d67dd6cc76b47038cf1
|
7
|
+
data.tar.gz: b1418935e1d6bff9e2fc93676ac8d93ee4f4c6a3ee30e1a5371781e1004adf1cddd24fd326f8a368fc692823a5a96464a555c14de82c8e1117a1dbaf0cc3a6da
|
data/.travis.yml
CHANGED
@@ -5,7 +5,8 @@ services:
|
|
5
5
|
rvm:
|
6
6
|
- 2.0
|
7
7
|
- 2.1
|
8
|
-
- 2.2
|
8
|
+
- 2.2.3
|
9
|
+
- 2.3.0
|
9
10
|
# - rbx
|
10
11
|
gemfile:
|
11
12
|
- gemfiles/rails.3.2.activerecord.gemfile
|
@@ -20,24 +21,55 @@ gemfile:
|
|
20
21
|
- gemfiles/rails.4.2.activerecord.gemfile
|
21
22
|
- gemfiles/rails.4.2.activerecord.kaminari.gemfile
|
22
23
|
- gemfiles/rails.4.2.activerecord.will_paginate.gemfile
|
23
|
-
- gemfiles/rails.
|
24
|
-
- gemfiles/rails.
|
25
|
-
- gemfiles/rails.
|
26
|
-
- gemfiles/rails.4.
|
27
|
-
- gemfiles/rails.4.
|
28
|
-
- gemfiles/rails.4.
|
29
|
-
- gemfiles/rails.4.
|
30
|
-
- gemfiles/rails.4.
|
31
|
-
- gemfiles/rails.4.
|
32
|
-
- gemfiles/
|
24
|
+
- gemfiles/rails.5.0.0.beta3.activerecord.gemfile
|
25
|
+
- gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile
|
26
|
+
- gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile
|
27
|
+
- gemfiles/rails.4.0.mongoid.4.0.0.gemfile
|
28
|
+
- gemfiles/rails.4.0.mongoid.4.0.0.kaminari.gemfile
|
29
|
+
- gemfiles/rails.4.0.mongoid.4.0.0.will_paginate.gemfile
|
30
|
+
- gemfiles/rails.4.0.mongoid.5.1.0.gemfile
|
31
|
+
- gemfiles/rails.4.0.mongoid.5.1.0.kaminari.gemfile
|
32
|
+
- gemfiles/rails.4.0.mongoid.5.1.0.will_paginate.gemfile
|
33
|
+
- gemfiles/rails.4.1.mongoid.4.0.0.gemfile
|
34
|
+
- gemfiles/rails.4.1.mongoid.4.0.0.kaminari.gemfile
|
35
|
+
- gemfiles/rails.4.1.mongoid.4.0.0.will_paginate.gemfile
|
36
|
+
- gemfiles/rails.4.1.mongoid.5.1.0.gemfile
|
37
|
+
- gemfiles/rails.4.1.mongoid.5.1.0.kaminari.gemfile
|
38
|
+
- gemfiles/rails.4.1.mongoid.5.1.0.will_paginate.gemfile
|
39
|
+
- gemfiles/rails.4.2.mongoid.4.0.0.gemfile
|
40
|
+
- gemfiles/rails.4.2.mongoid.4.0.0.kaminari.gemfile
|
41
|
+
- gemfiles/rails.4.2.mongoid.4.0.0.will_paginate.gemfile
|
42
|
+
- gemfiles/rails.4.2.mongoid.5.1.0.gemfile
|
43
|
+
- gemfiles/rails.4.2.mongoid.5.1.0.kaminari.gemfile
|
44
|
+
- gemfiles/rails.4.2.mongoid.5.1.0.will_paginate.gemfile
|
45
|
+
- gemfiles/sequel.4.31.gemfile
|
46
|
+
|
33
47
|
matrix:
|
34
48
|
exclude:
|
49
|
+
- rvm: 2.0
|
50
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.gemfile
|
51
|
+
- rvm: 2.0
|
52
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile
|
53
|
+
- rvm: 2.0
|
54
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile
|
55
|
+
- rvm: 2.1
|
56
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.gemfile
|
57
|
+
- rvm: 2.1
|
58
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile
|
59
|
+
- rvm: 2.1
|
60
|
+
gemfile: gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile
|
35
61
|
- rvm: 2.2
|
36
62
|
gemfile: gemfiles/rails.3.2.activerecord.gemfile
|
37
63
|
- rvm: 2.2
|
38
64
|
gemfile: gemfiles/rails.3.2.activerecord.kaminari.gemfile
|
39
65
|
- rvm: 2.2
|
40
66
|
gemfile: gemfiles/rails.3.2.activerecord.will_paginate.gemfile
|
67
|
+
- rvm: 2.3
|
68
|
+
gemfile: gemfiles/rails.3.2.activerecord.gemfile
|
69
|
+
- rvm: 2.3
|
70
|
+
gemfile: gemfiles/rails.3.2.activerecord.kaminari.gemfile
|
71
|
+
- rvm: 2.3
|
72
|
+
gemfile: gemfiles/rails.3.2.activerecord.will_paginate.gemfile
|
41
73
|
before_install:
|
42
74
|
- curl -# https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz | tar xz -C /tmp
|
43
75
|
before_script:
|
data/Appraisals
CHANGED
@@ -22,28 +22,55 @@
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
appraise "rails.#{version}.
|
27
|
-
gem '
|
28
|
-
gem 'activesupport', "~> #{version}
|
25
|
+
'5.0.0.beta3'.tap do |version|
|
26
|
+
appraise "rails.#{version}.activerecord" do
|
27
|
+
gem 'activerecord', "~> #{version}"
|
28
|
+
gem 'activesupport', "~> #{version}"
|
29
|
+
gem 'activejob', "~> #{version}"
|
29
30
|
gem 'resque', require: false
|
30
31
|
gem 'sidekiq', require: false
|
31
32
|
end
|
32
33
|
|
33
|
-
appraise "rails.#{version}.
|
34
|
-
gem '
|
35
|
-
gem 'activesupport', "~> #{version}
|
34
|
+
appraise "rails.#{version}.activerecord.kaminari" do
|
35
|
+
gem 'activerecord', "~> #{version}"
|
36
|
+
gem 'activesupport', "~> #{version}"
|
37
|
+
gem 'activejob', "~> #{version}"
|
38
|
+
gem 'actionpack', "~> #{version}"
|
36
39
|
gem 'kaminari', '0.16.3', require: false
|
37
40
|
end
|
38
41
|
|
39
|
-
appraise "rails.#{version}.
|
40
|
-
gem '
|
41
|
-
gem 'activesupport', "~> #{version}
|
42
|
+
appraise "rails.#{version}.activerecord.will_paginate" do
|
43
|
+
gem 'activerecord', "~> #{version}"
|
44
|
+
gem 'activesupport', "~> #{version}"
|
45
|
+
gem 'activejob', "~> #{version}" if version >= '4.2'
|
42
46
|
gem 'will_paginate', require: false
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
|
47
|
-
|
50
|
+
%w(4.0 4.1 4.2).each do |activesupport|
|
51
|
+
%w(4.0.0 5.1.0).each do |mongoid|
|
52
|
+
appraise "rails.#{activesupport}.mongoid.#{mongoid}" do
|
53
|
+
gem 'mongoid', "> #{mongoid}"
|
54
|
+
gem 'activesupport', "~> #{activesupport}.0"
|
55
|
+
gem 'resque', require: false
|
56
|
+
gem 'sidekiq', require: false
|
57
|
+
end
|
58
|
+
|
59
|
+
appraise "rails.#{activesupport}.mongoid.#{mongoid}.kaminari" do
|
60
|
+
gem 'mongoid', "> #{mongoid}"
|
61
|
+
gem 'activesupport', "~> #{activesupport}.0"
|
62
|
+
gem 'kaminari', '0.16.3', require: false
|
63
|
+
end
|
64
|
+
|
65
|
+
appraise "rails.#{activesupport}.mongoid.#{mongoid}.will_paginate" do
|
66
|
+
gem 'mongoid', "> #{mongoid}"
|
67
|
+
gem 'activesupport', "~> #{activesupport}.0"
|
68
|
+
gem 'will_paginate', require: false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
appraise "sequel.4.31" do
|
74
|
+
gem 'sequel', "~> 4.31.0"
|
48
75
|
gem 'activesupport', '~> 4.2.0'
|
49
76
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,47 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
## Changes
|
4
|
+
|
5
|
+
* Brand new import `:bulk_size` option, set desired ElasticSearch bulk size in bytes
|
6
|
+
|
7
|
+
* Witchcraft™ technology
|
8
|
+
|
9
|
+
* Configurable per-type default import options (@barthez, #341)
|
10
|
+
|
11
|
+
* Various codebase optimizations (@DNNX, @pyromaniac)
|
12
|
+
|
13
|
+
* `update_index` Rspec matcher messages improvements
|
14
|
+
|
15
|
+
* `:all` rake tasks deprecation
|
16
|
+
|
17
|
+
* Scoped notification subscriptions in rake tasks (@0x0badc0de, #335)
|
18
|
+
|
19
|
+
* Async strategies workers accept options (@dnd, #321)
|
20
|
+
|
21
|
+
* Prefix is configurable per-index (@mikeyhogarth, #314)
|
22
|
+
|
23
|
+
* Ability to pass proc for transport configuration (@feymartynov, @reidab, #302, #339)
|
24
|
+
|
25
|
+
* ElasticSearch 2 support (@sergeygaychuk, #297)
|
26
|
+
|
27
|
+
* Accessing types with methods is deprecated. Use `MyIndex::MyType` constant reference instead of `MyIndex.my_type` method.
|
28
|
+
|
29
|
+
* Sequel adapter improvements (@mrbrdo, #294)
|
30
|
+
|
31
|
+
## Bugfixes
|
32
|
+
|
33
|
+
* Mongoid atomic strategy fix (#325)
|
34
|
+
|
35
|
+
* Method missing fix (@jesjos, #324)
|
36
|
+
|
37
|
+
* Hash fields composition fix (@eproulx-petalmd, #319)
|
38
|
+
|
39
|
+
* Better errors handling in strategies (@barthez, #306)
|
40
|
+
|
41
|
+
* Assets strategies silencer fix for Rails 5 API mode (@clupprich, #303)
|
42
|
+
|
43
|
+
# Version 0.8.3
|
44
|
+
|
3
45
|
## Changes
|
4
46
|
|
5
47
|
* Sequel support completely reworked to use common ORM implementations + better sequel specs covarage.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -236,6 +236,23 @@ See [config.rb](lib/chewy/config.rb) for more details.
|
|
236
236
|
User.plugin :chewy_observe # just for User
|
237
237
|
```
|
238
238
|
|
239
|
+
### Type default import options
|
240
|
+
|
241
|
+
Every type has `default_import_options` configuration to specify, suddenly, default import options:
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
class ProductsIndex < Chewy::Index
|
245
|
+
define_type Post.includes(:tags) do
|
246
|
+
default_import_options batch_size: 100, bulk_size: 10.megabytes, refresh: false
|
247
|
+
|
248
|
+
field :name
|
249
|
+
field :tags, value: -> { tags.map(&:name) }
|
250
|
+
end
|
251
|
+
end
|
252
|
+
```
|
253
|
+
|
254
|
+
See [import.rb](lib/chewy/type/import.rb) for available options.
|
255
|
+
|
239
256
|
### Multi (nested) and object field types
|
240
257
|
|
241
258
|
To define an objects field you can simply nest fields in the DSL:
|
@@ -253,7 +270,7 @@ To define a multi field you have to specify any type except for `object` or `nes
|
|
253
270
|
|
254
271
|
```ruby
|
255
272
|
field :full_name, type: 'string', value: ->{ full_name.strip } do
|
256
|
-
field :ordered, analyzer:
|
273
|
+
field :ordered, analyzer: 'ordered'
|
257
274
|
field :untouched, index: 'not_analyzed'
|
258
275
|
end
|
259
276
|
```
|
@@ -310,7 +327,7 @@ Then you can replace Rails associations with Chewy Crutches™ technology:
|
|
310
327
|
|
311
328
|
```ruby
|
312
329
|
class ProductsIndex < Chewy::Index
|
313
|
-
define_type Product
|
330
|
+
define_type Product do
|
314
331
|
crutch :categories do |collection| # collection here is a current batch of products
|
315
332
|
# data is fetched with a lightweight query without objects initialization
|
316
333
|
data = ProductCategory.joins(:category).where(product_id: collection.map(&:id)).pluck(:product_id, 'categories.name')
|
@@ -343,6 +360,43 @@ end
|
|
343
360
|
|
344
361
|
So Chewy Crutches™ technology is able to increase your indexing performance in some cases up to a hundredfold or even more depending on your associations complexity.
|
345
362
|
|
363
|
+
### Witchcraft™ technology
|
364
|
+
|
365
|
+
One more experimental technology to increase import performance. As far as you know, chewy defines value proc for every imported field in mapping, so at the import time each of this procs is executed on imported object to extract result document to import. It would be great for performance to use one huge whole-document-returning proc instead. So basically the idea or Witchcraft™ technology is to compile a single document-returning proc from the type definition.
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
define_type Product do
|
369
|
+
witchcraft!
|
370
|
+
|
371
|
+
field :title
|
372
|
+
field :tags, value: -> { tags.map(&:name) }
|
373
|
+
field :categories do
|
374
|
+
field :name, value: -> (product, category) { category.name }
|
375
|
+
field :type, value: -> (product, category, crutch) { crutch.types[category.name] }
|
376
|
+
end
|
377
|
+
end
|
378
|
+
```
|
379
|
+
|
380
|
+
The type definition above will be compiled to something close to:
|
381
|
+
|
382
|
+
```ruby
|
383
|
+
-> (object, crutches) do
|
384
|
+
{
|
385
|
+
title: object.title,
|
386
|
+
tags: object.tags.map(&:name),
|
387
|
+
categories: object.categories.map do |object2|
|
388
|
+
{
|
389
|
+
name: object2.name
|
390
|
+
type: crutches.types[object2.name]
|
391
|
+
}
|
392
|
+
end
|
393
|
+
}
|
394
|
+
end
|
395
|
+
```
|
396
|
+
|
397
|
+
And don't even ask how is it possible, it is a witchcraft.
|
398
|
+
Obviously not every type of definition might be compiled, so use reasonable formatting to make `method_source` be able to extract field value proc sources. Also value procs with splat arguments are not supported right now. However, it is quite possible that your type definition will be supported by Witchcraft™ technology out of the box in the most of the cases.
|
399
|
+
|
346
400
|
### Types access
|
347
401
|
|
348
402
|
You can access index-defined types with the following API:
|
@@ -350,7 +404,6 @@ You can access index-defined types with the following API:
|
|
350
404
|
```ruby
|
351
405
|
UsersIndex::User # => UsersIndex::User
|
352
406
|
UsersIndex.type_hash['user'] # => UsersIndex::User
|
353
|
-
UsersIndex.user # => UsersIndex::User
|
354
407
|
UsersIndex.types # => [UsersIndex::User]
|
355
408
|
UsersIndex.type_names # => ['user']
|
356
409
|
```
|
@@ -514,7 +567,7 @@ There are a couple of predefined strategies for your Rails application. Initiall
|
|
514
567
|
|
515
568
|
Migrations are wrapped with the `:bypass` strategy. Because the main behavior implies that indices are reset after migration, there is no need for extra index updates. Also indexing might be broken during migrations because of the outdated schema.
|
516
569
|
|
517
|
-
Controller actions are wrapped with the `:atomic
|
570
|
+
Controller actions are wrapped with the configurable value of `Chewy.request_strategy` and defaults to `:atomic`. This is done at the middleware level to reduce the number of index update requests inside actions.
|
518
571
|
|
519
572
|
It is also a good idea to set up the `:bypass` strategy inside your test suite and import objects manually only when needed, and use `Chewy.massacre` when needed to flush test ES indices before every example. This will allow you to minimize unnecessary ES requests and reduce overhead.
|
520
573
|
|
@@ -920,9 +973,9 @@ avg_johns_rating = all_johns.aggs
|
|
920
973
|
```
|
921
974
|
|
922
975
|
It is possible to run into collisions between named aggregations. This occurs when there is more than one aggregation
|
923
|
-
with the same name. To explicitly reference an aggregation you provide a string to the #aggs method of the form:
|
976
|
+
with the same name. To explicitly reference an aggregation you provide a string to the #aggs method of the form:
|
924
977
|
`index_name#document_type.aggregation_name`
|
925
|
-
|
978
|
+
|
926
979
|
Consider this example where there are two separate aggregations named `avg_rating`
|
927
980
|
|
928
981
|
```ruby
|
@@ -949,7 +1002,7 @@ end
|
|
949
1002
|
|
950
1003
|
all_docs = UsersIndex.filter {match_all}.aggs("users#user.avg_rating")
|
951
1004
|
all_docs.aggs
|
952
|
-
# => {"users#user.avg_rating"=>{"value"=>3.5}}
|
1005
|
+
# => {"users#user.avg_rating"=>{"value"=>3.5}}
|
953
1006
|
```
|
954
1007
|
|
955
1008
|
### Script fields
|
data/chewy.gemspec
CHANGED
@@ -8,27 +8,34 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Chewy::VERSION
|
9
9
|
spec.authors = ['pyromaniac']
|
10
10
|
spec.email = ['kinwizard@gmail.com']
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = 'Elasticsearch ODM client wrapper'
|
12
|
+
spec.description = 'Chewy provides functionality for Elasticsearch index handling, documents import mappings and chainable query DSL'
|
13
13
|
spec.homepage = 'https://github.com/toptal/chewy'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split($RS)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'rake'
|
22
22
|
spec.add_development_dependency 'appraisal'
|
23
|
-
spec.add_development_dependency 'rspec'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
24
24
|
spec.add_development_dependency 'rspec-its'
|
25
25
|
spec.add_development_dependency 'rspec-collection_matchers'
|
26
26
|
spec.add_development_dependency 'sqlite3'
|
27
|
-
spec.add_development_dependency 'database_cleaner'
|
27
|
+
spec.add_development_dependency 'database_cleaner'
|
28
28
|
spec.add_development_dependency 'elasticsearch-extensions'
|
29
29
|
spec.add_development_dependency 'resque_spec'
|
30
30
|
spec.add_development_dependency 'rubysl', '~> 2.0' if RUBY_ENGINE == 'rbx'
|
31
31
|
|
32
|
+
spec.add_development_dependency 'method_source'
|
33
|
+
if RUBY_VERSION < '2.1.0'
|
34
|
+
spec.add_development_dependency 'unparser', '0.2.4'
|
35
|
+
else
|
36
|
+
spec.add_development_dependency 'unparser'
|
37
|
+
end
|
38
|
+
|
32
39
|
spec.add_dependency 'activesupport', '>= 3.2'
|
33
40
|
spec.add_dependency 'elasticsearch', '>= 1.0.0'
|
34
41
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "> 5.1.0"
|
6
|
+
gem "activesupport", "~> 4.0.0"
|
7
|
+
gem "resque", :require => false
|
8
|
+
gem "sidekiq", :require => false
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem "guard"
|
12
|
+
gem "guard-rspec"
|
13
|
+
end
|
14
|
+
|
15
|
+
gemspec :path => "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "> 5.1.0"
|
6
|
+
gem "activesupport", "~> 4.0.0"
|
7
|
+
gem "kaminari", "0.16.3", :require => false
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem "guard"
|
11
|
+
gem "guard-rspec"
|
12
|
+
end
|
13
|
+
|
14
|
+
gemspec :path => "../"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "> 5.1.0"
|
6
|
+
gem "activesupport", "~> 4.0.0"
|
7
|
+
gem "will_paginate", :require => false
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem "guard"
|
11
|
+
gem "guard-rspec"
|
12
|
+
end
|
13
|
+
|
14
|
+
gemspec :path => "../"
|