Skip to content

Commit 06f48d7

Browse files
committed
cleaned up
1 parent 25bc8a6 commit 06f48d7

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -335,20 +335,6 @@ public final void addIgnoredField(IgnoredSourceFieldMapper.NameValue values) {
335335
}
336336
}
337337

338-
/**
339-
* This function acts as a more "readable" wrapper around adding ignored fields.
340-
*
341-
* This is useful when we want to reuse the existing logic that {@link IgnoredSourceFieldMapper} provides for synthetic source, without
342-
* explicitly calling addIgnoredField(). Without this, it's a bit confusing why fields that are not meant to be ignored, are being
343-
* added to ignored source.
344-
*/
345-
public final void storeFieldForSyntheticSource(String fullPath, String leafName, BytesRef valueBytes, LuceneDocument doc) {
346-
if (canAddIgnoredField()) {
347-
var fieldData = new IgnoredSourceFieldMapper.NameValue(fullPath, fullPath.lastIndexOf(leafName), valueBytes, doc);
348-
ignoredFieldValues.add(fieldData);
349-
}
350-
}
351-
352338
/**
353339
* Return the collection of values for fields that have been ignored so far.
354340
*/

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,14 +1221,6 @@ private boolean indexValue(DocumentParserContext context, String value) {
12211221
return indexValue(context, new Text(value));
12221222
}
12231223

1224-
/**
1225-
* Returns whether this field should be stored separately as a {@link StoredField} for supporting synthetic source.
1226-
*/
1227-
private boolean storeIgnoredValuesForSyntheticSource() {
1228-
// skip all fields that are multi-fields
1229-
return fieldType().isSyntheticSourceEnabled && fieldType().isWithinMultiField == false;
1230-
}
1231-
12321224
private boolean indexValue(DocumentParserContext context, XContentString value) {
12331225
// nothing to index
12341226
if (value == null) {
@@ -1240,11 +1232,12 @@ private boolean indexValue(DocumentParserContext context, XContentString value)
12401232
return false;
12411233
}
12421234

1243-
// if the value's length exceeds ignore_above, then don't index it
1244-
if (value.stringLength() > fieldType().ignoreAbove()) {
1235+
// if the value's length exceeds ignore_above, then don't index it. Instead, store it in ignored source
1236+
// that being said, don't store multi fields in ignored source as thats the responsibility of the parent
1237+
if (value.stringLength() > fieldType().ignoreAbove() && isWithinMultiField == false) {
12451238
context.addIgnoredField(fullPath());
1246-
// unless, synthetic source is enabled, then store a copy of the value so that synthetic source be load it
1247-
if (storeIgnoredValuesForSyntheticSource()) {
1239+
// unless synthetic source is enabled, then store a copy of the value so that synthetic source be load it
1240+
if (fieldType().isSyntheticSourceEnabled) {
12481241
var utfBytes = value.bytes();
12491242
var bytesRef = new BytesRef(utfBytes.bytes(), utfBytes.offset(), utfBytes.length());
12501243
final String fieldName = fieldType().syntheticSourceFallbackFieldName();

0 commit comments

Comments
 (0)