diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-09-13 11:24:10 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-09-13 12:32:36 +0000 |
commit | 65ecb02c12d3f87ee3839bdddd14ce969a40d7ce (patch) | |
tree | c193afa889d34108c88d7dcec7be4d54a5c58516 /config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java | |
parent | cf494ca75f3dc3bd66ef90a8438a20a5dd447452 (diff) |
Allow dynamic transforms on array<string> summary fields.
Diffstat (limited to 'config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java b/config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java index 3afc25131c0..77a17878840 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/AddExtraFieldsToDocument.java @@ -10,6 +10,7 @@ import com.yahoo.schema.document.ImmutableSDField; import com.yahoo.schema.document.SDDocumentType; import com.yahoo.schema.document.SDField; import com.yahoo.vespa.documentmodel.SummaryField; +import com.yahoo.vespa.documentmodel.SummaryTransform; import com.yahoo.vespa.model.container.search.QueryProfiles; /** @@ -33,15 +34,14 @@ public class AddExtraFieldsToDocument extends Processor { } for (var docsum : schema.getSummaries().values()) { for (var summaryField : docsum.getSummaryFields().values()) { - switch (summaryField.getTransform()) { - case NONE: - case BOLDED: - case DYNAMICBOLDED: - case DYNAMICTEASER: - case DOCUMENT_ID: // TODO: Adding the 'documentid' field should no longer be needed when the docsum framework in the backend has been simplified and the transform is always used. + var transform = summaryField.getTransform(); + if (transform.isDynamic() && DynamicSummaryTransformUtils.summaryFieldIsRequiredInDocumentType(summaryField) || + transform == SummaryTransform.NONE || + transform == SummaryTransform.DOCUMENT_ID) + { + // TODO: Adding the 'documentid' field should no longer be needed when the docsum framework in the backend has been simplified and the transform is always used. addSummaryField(schema, document, summaryField, validate); - break; - default: + } else { // skip: generated from attribute or similar, // so does not need to be included as an extra // field in the document type |