Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Chewy::Type, simplify DSL #783

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ Lint/EmptyBlock:
- 'spec/chewy/search/scrolling_spec.rb'
- 'spec/chewy/strategy/atomic_spec.rb'
- 'spec/chewy/strategy_spec.rb'
- 'spec/chewy/type/import/bulk_request_spec.rb'
- 'spec/chewy/type/witchcraft_spec.rb'
- 'spec/chewy/index/import/bulk_request_spec.rb'
- 'spec/chewy/index/witchcraft_spec.rb'
- 'spec/chewy_spec.rb'

# Offense count: 3
Lint/MissingSuper:
Exclude:
- 'lib/chewy/strategy/atomic.rb'
- 'lib/chewy/type/adapter/object.rb'
- 'lib/chewy/type/adapter/orm.rb'
- 'lib/chewy/index/adapter/object.rb'
- 'lib/chewy/index/adapter/orm.rb'

# Offense count: 35
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Expand Down Expand Up @@ -85,8 +85,8 @@ Style/DocumentDynamicEvalDefinition:
- 'lib/chewy/index/actions.rb'
- 'lib/chewy/repository.rb'
- 'lib/chewy/search/pagination/kaminari.rb'
- 'lib/chewy/type/crutch.rb'
- 'lib/chewy/type/witchcraft.rb'
- 'lib/chewy/index/crutch.rb'
- 'lib/chewy/index/witchcraft.rb'

# Offense count: 58
Style/Documentation:
Expand Down Expand Up @@ -120,8 +120,8 @@ Style/IfUnlessModifier:
- 'lib/chewy/railtie.rb'
- 'lib/chewy/rspec/update_index.rb'
- 'lib/chewy/search/query_proxy.rb'
- 'lib/chewy/type/import.rb'
- 'lib/chewy/type/witchcraft.rb'
- 'lib/chewy/index/import.rb'
- 'lib/chewy/index/witchcraft.rb'
- 'spec/support/active_record.rb'

# Offense count: 53
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@

### Changes

* [#783](https://github.com/toptal/chewy/pull/783): **(Breaking)** Remove `Chewy::Type`, simplify DSL ([@rabotyaga][])
* Remove the `Chewy::Type` class
* e.g. remove `CitiesIndex::City` / `CitiesIndex.city`
* `CitiesIndex::City.import! ...` becomes `CitiesIndex.import! ...`
* Simplify index DSL:
* `define_type` block -> `index_scope` clause
* it can be omitted completely, if you don't need to specify the scope or options, e.g. `name`
* Remove type names from string representations:
* in `update_index` ActiveRecord helper and RSpec matcher, e.g.
* `update_index('cities#city')` -> `update_index('cities')`
* `update_index(UsersIndex::User)` -> `update_index(UsersIndex)`
* in rake tasks (e.g. `rake chewy:update[cities#city]` -> `rake chewy:update[cities]`)
* in rake tasks output (e.g. `Imported CitiesIndex::City in 1s, stats: index 3` -> `Imported CitiesIndex in 1s, stats: index 3`)
* Use index name instead of type name in loader additional scope
* e.g. `CitiesIndex.filter(...).load(city: {scope: City.where(...)})` -> `CitiesIndex.filter(...).load(cities: {scope: City.where(...)})`
* [#692](https://github.com/toptal/chewy/issues/692): Add `.update_mapping` to Index class ([@Vitalina-Vakulchyk][]):
* Wrapped Elasticsearch gem `.put_mapping` with `.update_mapping` in Index class
* Add `rake chewy:update_mapping` task
Expand Down
Loading