use of com.yahoo.vespa.documentmodel.SummaryField in project vespa by vespa-engine.
the class CreatePositionZCurve method removeSummaryTo.
private Set<String> removeSummaryTo(SDField field) {
Set<String> summaryTo = new HashSet<>();
Collection<SummaryField> summaryFields = field.getSummaryFields();
for (SummaryField summary : summaryFields) {
summaryTo.addAll(summary.getDestinations());
}
summaryFields.clear();
return summaryTo;
}
use of com.yahoo.vespa.documentmodel.SummaryField in project vespa by vespa-engine.
the class ImplicitSummaries method addPrefetchAttribute.
private void addPrefetchAttribute(Attribute attribute, SDField field, Search search) {
if (attribute.getPrefetchValue() == null) {
// Prefetch by default - unless any summary makes this dynamic
// Check if there is an implicit dynamic definition
SummaryField fieldSummaryField = field.getSummaryField(attribute.getName());
if (fieldSummaryField != null && fieldSummaryField.getTransform().isDynamic())
return;
// Check if an explicit class makes it dynamic (first is enough, as all must be the same, checked later)
SummaryField explicitSummaryField = search.getExplicitSummaryField(attribute.getName());
if (explicitSummaryField != null && explicitSummaryField.getTransform().isDynamic())
return;
}
DocumentSummary summary = getOrCreateAttributePrefetchSummary(search);
SummaryField attributeSummaryField = new SummaryField(attribute.getName(), attribute.getDataType());
attributeSummaryField.addSource(attribute.getName());
attributeSummaryField.addDestination("attributeprefetch");
attributeSummaryField.setTransform(SummaryTransform.ATTRIBUTE);
summary.add(attributeSummaryField);
}
use of com.yahoo.vespa.documentmodel.SummaryField in project vespa by vespa-engine.
the class SummaryInFieldLongOperation method apply.
public void apply(SDField field) {
if (type == null) {
type = field.getDataType();
}
SummaryField summary = new SummaryField(name, type);
applyToSummary(summary);
field.addSummaryField(summary);
}
use of com.yahoo.vespa.documentmodel.SummaryField in project vespa by vespa-engine.
the class BoldingOperation method apply.
public void apply(SDField field) {
SummaryField summaryField = field.getSummaryField(field.getName(), true);
summaryField.addSource(field.getName());
summaryField.addDestination("default");
summaryField.setTransform(bold ? summaryField.getTransform().bold() : summaryField.getTransform().unbold());
}
use of com.yahoo.vespa.documentmodel.SummaryField in project vespa by vespa-engine.
the class SummaryNamesFieldCollisions method process.
@Override
public void process(boolean validate) {
if (!validate)
return;
Map<String, Pair<String, String>> fieldToClassAndSource = new HashMap<>();
for (DocumentSummary summary : search.getSummaries().values()) {
if ("default".equals(summary.getName()))
continue;
for (SummaryField summaryField : summary.getSummaryFields()) {
if (summaryField.isImplicit())
continue;
Pair<String, String> prevClassAndSource = fieldToClassAndSource.get(summaryField.getName());
for (Source source : summaryField.getSources()) {
if (prevClassAndSource != null) {
String prevClass = prevClassAndSource.getFirst();
String prevSource = prevClassAndSource.getSecond();
if (!prevClass.equals(summary.getName())) {
if (!prevSource.equals(source.getName())) {
throw new IllegalArgumentException("For search '" + search.getName() + "', summary class '" + summary.getName() + "'," + " summary field '" + summaryField.getName() + "':" + " Can not use source '" + source.getName() + "' for this summary field, an equally named field in summary class '" + prevClass + "' uses a different source: '" + prevSource + "'.");
}
}
} else {
fieldToClassAndSource.put(summaryField.getName(), new Pair<>(summary.getName(), source.getName()));
}
}
}
}
}
Aggregations