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

Rename Mapper#name to Mapper#fullPath #110040

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

javanna
Copy link
Member

@javanna javanna commented Jun 21, 2024

This addresses a long standing TODO that caused quite a few bugs over time, in that the mapper name does not include its full path, while the MappedFieldType name does.

We have renamed Mapper.Builder#name to leafName (#109971) and Mapper#simpleName to leafName (#110030). This commit renames Mapper#name to fullPath for clarity This required some adjustments in FieldAliasMapper to avoid confusion between the existing path method and fullPath. I renamed path to targetPath for clarity. ObjectMapper already had a fullPath method that returned name, and was effectively a copy of name, so it could be removed.

Note that this will require adjustments for plugin developers that implement custom mappers. They will need to switch from using name() to fullPath() in their code.

This addresses a long standing TODO that caused quite a few bugs over time, in that the mapper name does not include its full path, while the MappedFieldType name does.

We have renamed Mapper.Builder#name to leafName (elastic#109971) and Mapper#simpleName to leafName (elastic#110030). This commit renames Mapper#name to fullPath for clarity
This required some adjustments in FieldAliasMapper to avoid confusion between the existing path method and fullPath. I renamed path to targetPath for clarity.
ObjectMapper already had a fullPath method that returned name, and was effectively a copy of name, so it could be removed.
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >breaking-java >refactoring v8.15.0 labels Jun 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Jun 21, 2024
Copy link
Member

@piergm piergm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks Luca for these PRs, the code is much more clear now!

Comment on lines +63 to +67
/**
* Returns the name of the field.
* When the field has a parent object, its leaf name won't include the entire path.
* When subobjects are disabled, its leaf name will be the same as {@link #fullPath()} in practice, because its parent is the root.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ on the docs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad you noticed that in the diff!

@javanna javanna merged commit 915e4a5 into elastic:main Jun 21, 2024
15 checks passed
@javanna javanna deleted the refactoring/name_mapper_full_path branch June 21, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking-java >refactoring :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants