Rename Mapper#name to Mapper#fullPath (#110040)

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.
This commit is contained in:
Luca Cavanna 2024-06-21 22:47:27 +02:00 committed by GitHub
parent b0d9f95e53
commit 915e4a50c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 354 additions and 312 deletions

View file

@ -580,11 +580,11 @@ public class AnnotatedTextFieldMapper extends FieldMapper {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (copyTo.copyToFields().isEmpty() != true) {
throw new IllegalArgumentException(
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
"field [" + fullPath() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
);
}
if (fieldType.stored()) {
return new StringStoredFieldFieldLoader(name(), leafName(), null) {
return new StringStoredFieldFieldLoader(fullPath(), leafName(), null) {
@Override
protected void write(XContentBuilder b, Object value) throws IOException {
b.value((String) value);
@ -602,7 +602,7 @@ public class AnnotatedTextFieldMapper extends FieldMapper {
Locale.ROOT,
"field [%s] of type [%s] doesn't support synthetic source unless it is stored or has a sub-field of"
+ " type [keyword] with doc values or stored and without a normalizer",
name(),
fullPath(),
typeName()
)
);