private void makeAttributeTokensTransformIfAppropriate(SummaryField summaryField, String docsumName, Schema schema) {
        if (summaryField.getTransform() == SummaryTransform.TOKENS) {
            String sourceFieldName = summaryField.getSingleSource();
            Attribute attribute = schema.getAttribute(sourceFieldName);
            ImmutableSDField source = schema.getField(sourceFieldName);
            if (!source.doesIndexing()) {
                if (attribute != null) {
                    summaryField.setTransform(SummaryTransform.ATTRIBUTE_TOKENS);
                } else {
                    throw new IllegalArgumentException("For schema '" + schema.getName() +
                            "', document-summary '" + docsumName +
                            "', summary field '" + summaryField.getName() +
                            "', source field '" + sourceFieldName +
                            "': tokens summary field setting requires index or attribute for source field");
                }
            }
        }
    }
If the source is a complex field with only struct field attributes then make this use the attribute combiner transform
config-model/src/main/java/com/yahoo/schema/processing/AdjustSummaryTransforms.java