use of com.yahoo.vespa.documentmodel.SummaryTransform in project vespa by vespa-engine.
the class AddAttributeTransformToSummaryOfImportedFieldsTest method attribute_summary_transform_applied_to_summary_field_of_imported_field.
@Test
public void attribute_summary_transform_applied_to_summary_field_of_imported_field() {
Search search = createSearchWithDocument(DOCUMENT_NAME);
search.setImportedFields(createSingleImportedField(IMPORTED_FIELD_NAME));
search.addSummary(createDocumentSummary(IMPORTED_FIELD_NAME));
AddAttributeTransformToSummaryOfImportedFields processor = new AddAttributeTransformToSummaryOfImportedFields(search, null, null, null);
processor.process(true);
SummaryField summaryField = search.getSummaries().get(SUMMARY_NAME).getSummaryField(IMPORTED_FIELD_NAME);
SummaryTransform actualTransform = summaryField.getTransform();
assertEquals(SummaryTransform.ATTRIBUTE, actualTransform);
}
use of com.yahoo.vespa.documentmodel.SummaryTransform in project vespa by vespa-engine.
the class IndexingScriptChangeMessageBuilder method checkSummaryTransform.
private void checkSummaryTransform(ChangeMessageBuilder builder) {
for (SummaryField nextSummaryField : nextField.getSummaryFields()) {
String fieldName = nextSummaryField.getName();
SummaryField currentSummaryField = currentField.getSummaryField(fieldName);
if (currentSummaryField != null) {
SummaryTransform currentTransform = currentSummaryField.getTransform();
SummaryTransform nextTransform = nextSummaryField.getTransform();
if (!currentSummaryField.getTransform().equals(nextSummaryField.getTransform())) {
builder.addChange("summary field '" + fieldName + "' transform", currentTransform.getName(), nextTransform.getName());
}
}
}
}
use of com.yahoo.vespa.documentmodel.SummaryTransform in project vespa by vespa-engine.
the class IndexingOutputs method fillSummaryToFromSummaryField.
private void fillSummaryToFromSummaryField(Search search, SDField field, SummaryField summaryField, Set<String> dynamicSummary, Set<String> staticSummary) {
SummaryTransform summaryTransform = summaryField.getTransform();
String summaryName = summaryField.getName();
if (summaryTransform.isDynamic() && summaryField.getSourceCount() > 2) {
// summary rewriter in the search core.
return;
}
if (summaryTransform.isDynamic()) {
DataType fieldType = field.getDataType();
if (fieldType != DataType.URI && fieldType != DataType.STRING) {
warn(search, field, "Dynamic summaries are only supported for fields of type " + "string, ignoring summary field '" + summaryField.getName() + "' for sd field '" + field.getName() + "' of type " + fieldType.getName() + ".");
return;
}
dynamicSummary.add(summaryName);
} else if (summaryTransform != SummaryTransform.ATTRIBUTE) {
staticSummary.add(summaryName);
}
}
Aggregations