|
76 | 76 | import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; |
77 | 77 | import org.elasticsearch.xcontent.ToXContent; |
78 | 78 | import org.elasticsearch.xcontent.XContentBuilder; |
79 | | -import org.elasticsearch.xcontent.XContentParser; |
80 | 79 |
|
81 | 80 | import java.io.IOException; |
82 | 81 | import java.util.ArrayList; |
@@ -1030,9 +1029,8 @@ public boolean canUseSyntheticSourceDelegateForQuerying() { |
1030 | 1029 | */ |
1031 | 1030 | public boolean canUseSyntheticSourceDelegateForSyntheticSource(final String value) { |
1032 | 1031 | if (syntheticSourceDelegate.isPresent()) { |
1033 | | - KeywordFieldMapper.KeywordFieldType kwdFieldType = syntheticSourceDelegate.get(); |
1034 | 1032 | // if the keyword field is going to be ignored, then we can't rely on it for synthetic source |
1035 | | - return kwdFieldType.isIgnored(value) == false; |
| 1033 | + return syntheticSourceDelegate.get().isIgnored(value) == false; |
1036 | 1034 | } |
1037 | 1035 | return false; |
1038 | 1036 | } |
@@ -1086,60 +1084,10 @@ protected String delegatingTo() { |
1086 | 1084 | return new BlockStoredFieldsReader.BytesFromStringsBlockLoader(name()); |
1087 | 1085 | } |
1088 | 1086 |
|
1089 | | - // _ignored_source field will contain entries for this field if it is not stored |
1090 | | - // and there is no syntheticSourceDelegate. |
1091 | | - // See #syntheticSourceSupport(). |
1092 | | - // But if a text field is a multi field it won't have an entry in _ignored_source. |
1093 | | - // The parent might, but we don't have enough context here to figure this out. |
1094 | | - // So we bail. |
1095 | | - if (isSyntheticSourceEnabled && syntheticSourceDelegate.isEmpty() && parentField == null) { |
1096 | | - return fallbackSyntheticSourceBlockLoader(blContext); |
1097 | | - } |
1098 | | - |
1099 | 1087 | SourceValueFetcher fetcher = SourceValueFetcher.toString(blContext.sourcePaths(name())); |
1100 | 1088 | return new BlockSourceReader.BytesRefsBlockLoader(fetcher, blockReaderDisiLookup(blContext)); |
1101 | 1089 | } |
1102 | 1090 |
|
1103 | | - FallbackSyntheticSourceBlockLoader fallbackSyntheticSourceBlockLoader(BlockLoaderContext blContext) { |
1104 | | - var reader = new FallbackSyntheticSourceBlockLoader.SingleValueReader<BytesRef>(null) { |
1105 | | - @Override |
1106 | | - public void convertValue(Object value, List<BytesRef> accumulator) { |
1107 | | - if (value != null) { |
1108 | | - accumulator.add(new BytesRef(value.toString())); |
1109 | | - } |
1110 | | - } |
1111 | | - |
1112 | | - @Override |
1113 | | - protected void parseNonNullValue(XContentParser parser, List<BytesRef> accumulator) throws IOException { |
1114 | | - var text = parser.textOrNull(); |
1115 | | - |
1116 | | - if (text != null) { |
1117 | | - accumulator.add(new BytesRef(text)); |
1118 | | - } |
1119 | | - } |
1120 | | - |
1121 | | - @Override |
1122 | | - public void writeToBlock(List<BytesRef> values, BlockLoader.Builder blockBuilder) { |
1123 | | - var bytesRefBuilder = (BlockLoader.BytesRefBuilder) blockBuilder; |
1124 | | - |
1125 | | - for (var value : values) { |
1126 | | - bytesRefBuilder.appendBytesRef(value); |
1127 | | - } |
1128 | | - } |
1129 | | - }; |
1130 | | - |
1131 | | - return new FallbackSyntheticSourceBlockLoader( |
1132 | | - reader, |
1133 | | - name(), |
1134 | | - IgnoredSourceFieldMapper.ignoredSourceFormat(blContext.indexSettings().getIndexVersionCreated()) |
1135 | | - ) { |
1136 | | - @Override |
1137 | | - public Builder builder(BlockFactory factory, int expectedCount) { |
1138 | | - return factory.bytesRefs(expectedCount); |
1139 | | - } |
1140 | | - }; |
1141 | | - } |
1142 | | - |
1143 | 1091 | /** |
1144 | 1092 | * Build an iterator of documents that have the field. This mirrors parseCreateField, |
1145 | 1093 | * using whatever |
|
0 commit comments