Skip to content

Commit 0a1bad7

Browse files
committed
Reverted merge flip
1 parent debf0ef commit 0a1bad7

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
@@ -1636,7 +1636,8 @@ protected void writeValue(Object value, XContentBuilder b) throws IOException {
16361636
var kwd = TextFieldMapper.SyntheticSourceHelper.getKeywordFieldMapperForSyntheticSource(this);
16371637
if (kwd != null) {
16381638
// merge the two field loaders into one
1639-
return kwd.syntheticFieldLoader(fullPath(), leafName()).mergedWith(fieldLoader);
1639+
var kwdFieldLoader = kwd.syntheticFieldLoader(fullPath(), leafName());
1640+
return fieldLoader.mergedWith(kwdFieldLoader);
16401641
}
16411642

16421643
return fieldLoader;

0 commit comments

Comments
 (0)