blob: 2d9cf3acf4ea3d3f4c5ad0c98cb1daa14c6ab6c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.fieldoperation;
import com.yahoo.schema.document.SDField;
import com.yahoo.vespa.documentmodel.SummaryField;
import java.util.Set;
/**
* @author Einar M R Rosenvinge
*/
public class SummaryToOperation implements FieldOperation {
private Set<String> destinations = new java.util.LinkedHashSet<>();
private String name;
public void setName(String name) {
this.name = name;
}
public void addDestination(String destination) {
destinations.add(destination);
}
public void apply(SDField field) {
SummaryField summary;
summary = field.getSummaryField(name);
if (summary == null) {
summary = new SummaryField(field);
summary.addSource(field.getName());
summary.addDestination("default");
field.addSummaryField(summary);
}
summary.setImplicit(false);
for (String destination : destinations) {
summary.addDestination(destination);
}
}
}
|