Skip to content

Commit e8c8411

Browse files
committed
Allow plugins outside core package to access and override some function of FieldMapper
Signed-off-by: Bo Zhang <[email protected]>
1 parent d2d5d5f commit e8c8411

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

plugins/analysis-icu/src/main/java/org/opensearch/index/mapper/ICUCollationKeywordFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, S
144144
}
145145

146146
@Override
147-
protected BytesRef indexedValueForSearch(Object value) {
147+
public BytesRef indexedValueForSearch(Object value) {
148148
if (value == null) {
149149
return null;
150150
}

server/src/main/java/org/opensearch/index/mapper/FlatObjectFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public Object valueForDisplay(Object value) {
294294
}
295295

296296
@Override
297-
protected BytesRef indexedValueForSearch(Object value) {
297+
public BytesRef indexedValueForSearch(Object value) {
298298
if (getTextSearchInfo().getSearchAnalyzer() == Lucene.KEYWORD_ANALYZER) {
299299
// flat_object analyzer with the default attribute source which encodes terms using UTF8
300300
// in that case we skip normalization, which may be slow if there many terms need to

server/src/main/java/org/opensearch/index/mapper/KeywordFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public Object valueForDisplay(Object value) {
378378
}
379379

380380
@Override
381-
protected BytesRef indexedValueForSearch(Object value) {
381+
public BytesRef indexedValueForSearch(Object value) {
382382
if (getTextSearchInfo().getSearchAnalyzer() == Lucene.KEYWORD_ANALYZER) {
383383
// keyword analyzer with the default attribute source which encodes terms using UTF8
384384
// in that case we skip normalization, which may be slow if there many terms need to

server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,14 @@ public NumberType numberType() {
15571557
return type;
15581558
}
15591559

1560+
public Number nullValue() {
1561+
return nullValue;
1562+
}
1563+
1564+
public boolean coerce() {
1565+
return coerce;
1566+
}
1567+
15601568
public NumericType numericType() {
15611569
return type.numericType();
15621570
}

server/src/main/java/org/opensearch/index/mapper/ParametrizedFieldMapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected ParametrizedFieldMapper(String simpleName, MappedFieldType mappedField
9595
public abstract ParametrizedFieldMapper.Builder getMergeBuilder();
9696

9797
@Override
98-
public final ParametrizedFieldMapper merge(Mapper mergeWith) {
98+
public ParametrizedFieldMapper merge(Mapper mergeWith) {
9999

100100
if (mergeWith instanceof FieldMapper == false) {
101101
throw new IllegalArgumentException(
@@ -348,7 +348,7 @@ private void merge(FieldMapper toMerge, Conflicts conflicts) {
348348
}
349349
}
350350

351-
protected void toXContent(XContentBuilder builder, boolean includeDefaults) throws IOException {
351+
public void toXContent(XContentBuilder builder, boolean includeDefaults) throws IOException {
352352
if (serializerCheck.check(includeDefaults, isConfigured(), get())) {
353353
serializer.serialize(builder, name, getValue());
354354
}
@@ -649,7 +649,7 @@ protected String buildFullName(BuilderContext context) {
649649
/**
650650
* Writes the current builder parameter values as XContent
651651
*/
652-
protected final void toXContent(XContentBuilder builder, boolean includeDefaults) throws IOException {
652+
public final void toXContent(XContentBuilder builder, boolean includeDefaults) throws IOException {
653653
for (Parameter<?> parameter : getParameters()) {
654654
parameter.toXContent(builder, includeDefaults);
655655
}

server/src/main/java/org/opensearch/index/mapper/TermBasedFieldType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public TermBasedFieldType(
6969
/** Returns the indexed value used to construct search "values".
7070
* This method is used for the default implementations of most
7171
* query factory methods such as {@link #termQuery}. */
72-
protected BytesRef indexedValueForSearch(Object value) {
72+
public BytesRef indexedValueForSearch(Object value) {
7373
return BytesRefs.toBytesRef(value);
7474
}
7575

0 commit comments

Comments
 (0)