-
Notifications
You must be signed in to change notification settings - Fork 369
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rabotyaga
force-pushed
the
remove-types
branch
4 times, most recently
from
April 15, 2021 15:34
e347bca
to
5e3bc7f
Compare
AlfonsoUceda
approved these changes
Apr 17, 2021
dalthon
approved these changes
Apr 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that most of the work was based to move modules that once were included at Chewy::Type
to Chewy::Index
, and changing edge cases like index_scope
, it LGTM!
- 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(...)})`
cyucelen
pushed a commit
to cyucelen/chewy
that referenced
this pull request
Jan 28, 2023
- 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(...)})`
cyucelen
pushed a commit
to cyucelen/chewy
that referenced
this pull request
Jan 28, 2023
- 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(...)})`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove the type concept from internals completely, as Elasticsearch is removing types:
Chewy::Type
classCitiesIndex::City
/CitiesIndex.city
CitiesIndex::City.import! ...
becomesCitiesIndex.import! ...
define_type
block ->index_scope
clausename
update_index
ActiveRecord helper and RSpec matcher, e.g.update_index('cities#city')
->update_index('cities')
update_index(UsersIndex::User)
->update_index(UsersIndex)
rake chewy:update[cities#city]
->rake chewy:update[cities]
)Imported CitiesIndex::City in 1s, stats: index 3
->Imported CitiesIndex in 1s, stats: index 3
)CitiesIndex.filter(...).load(city: {scope: City.where(...)})
->CitiesIndex.filter(...).load(cities: {scope: City.where(...)})
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).