Skip to content

Commit 176ee56

Browse files
committed
Temporarily remove bwc check
1 parent a3a8a15 commit 176ee56

File tree

4 files changed

+24
-27
lines changed

4 files changed

+24
-27
lines changed

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

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public static class Builder extends FieldMapper.Builder {
245245
private final IndexMode indexMode;
246246

247247
private final Parameter<Boolean> index = Parameter.indexParam(m -> ((TextFieldMapper) m).index, true);
248-
private Parameter<Boolean> store = Parameter.storeParam(m -> ((TextFieldMapper) m).store, false);
248+
private final Parameter<Boolean> store = Parameter.storeParam(m -> ((TextFieldMapper) m).store, false);
249249

250250
final Parameter<SimilarityProvider> similarity = TextParams.similarity(m -> ((TextFieldMapper) m).similarity);
251251

@@ -317,8 +317,8 @@ public Builder(
317317

318318
// don't enable norms by default if the index is LOGSDB or TSDB based
319319
this.norms = Parameter.normsParam(
320-
m -> ((TextFieldMapper) m).norms,
321-
() -> indexMode != IndexMode.LOGSDB && indexMode != IndexMode.TIME_SERIES
320+
m -> ((TextFieldMapper) m).norms,
321+
() -> indexMode != IndexMode.LOGSDB && indexMode != IndexMode.TIME_SERIES
322322
);
323323
}
324324

@@ -471,18 +471,18 @@ private SubFieldInfo buildPhraseInfo(FieldType fieldType, TextFieldType parent)
471471
public TextFieldMapper build(MapperBuilderContext context) {
472472
this.isSyntheticSourceEnabled = context.isSourceSynthetic();
473473

474-
// backwards compatibility checks
475-
if (keywordMultiFieldsNotStoredWhenIgnored_indexVersionCheck(indexCreatedVersion) == false) {
476-
this.store = Parameter.storeParam(m -> ((TextFieldMapper) m).store, () -> {
477-
if (multiFieldsNotStoredByDefault_indexVersionCheck(indexCreatedVersion)) {
478-
return isSyntheticSourceEnabled
479-
&& isWithinMultiField == false
480-
&& multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
481-
} else {
482-
return isSyntheticSourceEnabled && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
483-
}
484-
});
485-
}
474+
// // backwards compatibility checks
475+
// if (this.store.isSet() == false && keywordMultiFieldsNotStoredWhenIgnored_indexVersionCheck(indexCreatedVersion) == false) {
476+
// this.store = Parameter.storeParam(m -> ((TextFieldMapper) m).store, () -> {
477+
// if (multiFieldsNotStoredByDefault_indexVersionCheck(indexCreatedVersion)) {
478+
// return isSyntheticSourceEnabled
479+
// && isWithinMultiField == false
480+
// && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
481+
// } else {
482+
// return isSyntheticSourceEnabled && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
483+
// }
484+
// });
485+
// }
486486

487487
FieldType fieldType = TextParams.buildFieldType(
488488
index,
@@ -506,13 +506,7 @@ public TextFieldMapper build(MapperBuilderContext context) {
506506
}
507507

508508
public static final TypeParser PARSER = createTypeParserWithLegacySupport(
509-
(n, c) -> new Builder(
510-
n,
511-
c.indexVersionCreated(),
512-
c.getIndexSettings().getMode(),
513-
c.getIndexAnalyzers(),
514-
c.isWithinMultiField()
515-
)
509+
(n, c) -> new Builder(n, c.indexVersionCreated(), c.getIndexSettings().getMode(), c.getIndexAnalyzers(), c.isWithinMultiField())
516510
);
517511

518512
private static class PhraseWrappedAnalyzer extends AnalyzerWrapper {
@@ -1305,7 +1299,6 @@ public Query existsQuery(SearchExecutionContext context) {
13051299

13061300
}
13071301

1308-
private final IndexVersion indexCreatedVersion;
13091302
private final IndexMode indexMode;
13101303
private final boolean index;
13111304
private final boolean store;

server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ public void testNestedObjectWithMultiFieldsgetTotalFieldsCount() {
739739
new KeywordFieldMapper.Builder("multi_field_size_4", IndexVersion.current(), true)
740740
)
741741
.addMultiField(
742-
new TextFieldMapper.Builder("grand_child_size_5", IndexVersion.current(), createDefaultIndexAnalyzers(), true)
742+
new TextFieldMapper.Builder("grand_child_size_5", IndexVersion.current(), null, createDefaultIndexAnalyzers(), true)
743743
.addMultiField(
744744
new KeywordFieldMapper.Builder("multi_field_of_multi_field_size_6", IndexVersion.current(), true)
745745
)

test/framework/src/main/java/org/elasticsearch/index/mapper/KeywordFieldSyntheticSourceSupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public MapperTestCase.SyntheticSourceExample example(int maxValues, boolean load
8080
// this is an ugly little hack that flips the order of ignored values, which is important for the text-family fields where the
8181
// ordering of produced synthetic source values can be different from what was supplied
8282
var syntheticSourceOutputList = flipOrder
83-
? Stream.concat(ignoredValues.stream(), validValuesInCorrectOrder.stream()).toList()
84-
: Stream.concat(validValuesInCorrectOrder.stream(), ignoredValues.stream()).toList();
83+
? Stream.concat(ignoredValues.stream(), validValuesInCorrectOrder.stream()).toList()
84+
: Stream.concat(validValuesInCorrectOrder.stream(), ignoredValues.stream()).toList();
8585
out = syntheticSourceOutputList.size() == 1 ? syntheticSourceOutputList.get(0) : syntheticSourceOutputList;
8686
}
8787

test/framework/src/main/java/org/elasticsearch/index/mapper/TextFieldFamilySyntheticSourceTestSetup.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ public MapperTestCase.SyntheticSourceExample example(int maxValues) {
8181
// Block loader will not use keyword multi-field if it has ignore_above configured.
8282
// And in this case it will use values from source.
8383
boolean loadingFromSource = ignoreAbove != null;
84-
MapperTestCase.SyntheticSourceExample delegate = keywordMultiFieldSyntheticSourceSupport.example(maxValues, loadingFromSource, true);
84+
MapperTestCase.SyntheticSourceExample delegate = keywordMultiFieldSyntheticSourceSupport.example(
85+
maxValues,
86+
loadingFromSource,
87+
true
88+
);
8589

8690
return new MapperTestCase.SyntheticSourceExample(delegate.inputValue(), delegate.expectedForSyntheticSource(), b -> {
8791
b.field("type", fieldType);

0 commit comments

Comments
 (0)