Skip to content

Commit 538dbca

Browse files
committed
Reverted merge flip
1 parent 810e77a commit 538dbca

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,8 @@ protected void writeValue(Object value, XContentBuilder b) throws IOException {
734734
var kwd = TextFieldMapper.SyntheticSourceHelper.getKeywordFieldMapperForSyntheticSource(this);
735735
if (kwd != null) {
736736
// merge the two field loaders into one
737-
return kwd.syntheticFieldLoader(fullPath(), leafName()).mergedWith(fieldLoader);
737+
var kwdFieldLoader = kwd.syntheticFieldLoader(fullPath(), leafName());
738+
return fieldLoader.mergedWith(kwdFieldLoader);
738739
}
739740

740741
return fieldLoader;

modules/mapper-extras/src/yamlRestTest/resources/rest-api-spec/test/match_only_text/10_basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,8 @@ synthetic_source match_only_text with ignored multi-field and multiple values in
689689
foo: this value is
690690

691691
- match: { "hits.total.value": 1 }
692-
- match: { hits.hits.0._source.foo.0: "This value is too long and will be ignored" }
693-
- match: { hits.hits.0._source.foo.1: "This value is short" }
692+
- match: { hits.hits.0._source.foo.0: "This value is short" }
693+
- match: { hits.hits.0._source.foo.1: "This value is too long and will be ignored" }
694694

695695
---
696696
synthetic_source match_only_text with stored multi-field:

plugins/mapper-annotated-text/src/main/java/org/elasticsearch/index/mapper/annotatedtext/AnnotatedTextFieldMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ protected void writeValue(Object value, XContentBuilder b) throws IOException {
621621
var kwd = TextFieldMapper.SyntheticSourceHelper.getKeywordFieldMapperForSyntheticSource(this);
622622
if (kwd != null) {
623623
// merge the two field loaders into one
624-
return kwd.syntheticFieldLoader(fullPath(), leafName()).mergedWith(fieldLoader);
624+
var kwdFieldLoader = kwd.syntheticFieldLoader(fullPath(), leafName());
625+
return fieldLoader.mergedWith(kwdFieldLoader);
625626
}
626627

627628
return fieldLoader;

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/mapping/20_synthetic_source.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,5 @@ synthetic_source text with ignored multi-field and multiple values in the same d
161161
foo: this value is
162162

163163
- match: { "hits.total.value": 1 }
164-
- match: { hits.hits.0._source.foo: "This value is too long and will be ignored" }
165-
- match: { hits.hits.0._source.foo: "This value is short" }
164+
- match: { hits.hits.0._source.foo.0: "This value is short" }
165+
- match: { hits.hits.0._source.foo.1: "This value is too long and will be ignored" }

server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,8 @@ protected void writeValue(Object value, XContentBuilder b) throws IOException {
16611661
var kwd = TextFieldMapper.SyntheticSourceHelper.getKeywordFieldMapperForSyntheticSource(this);
16621662
if (kwd != null) {
16631663
// merge the two field loaders into one
1664-
return kwd.syntheticFieldLoader(fullPath(), leafName()).mergedWith(fieldLoader);
1664+
var kwdFieldLoader = kwd.syntheticFieldLoader(fullPath(), leafName());
1665+
return fieldLoader.mergedWith(kwdFieldLoader);
16651666
}
16661667

16671668
return fieldLoader;

0 commit comments

Comments
 (0)