com.yahoo.vespa.documentmodel.SummaryField Maven / Gradle / Ivy
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.documentmodel;
import com.yahoo.document.DataType;
import com.yahoo.document.Field;
import com.yahoo.vespa.objects.FieldBase;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.stream.Collectors;
import static com.yahoo.text.Lowercase.toLowerCase;
/**
* A summary field
*
* @author bratseth
*/
public class SummaryField extends FieldBase implements Cloneable {
/** A source (field name). */
public static class Source implements Serializable {
private final String name;
private boolean override = false;
public Source(String name) {
this.name = name;
}
public String getName() { return name; }
public void setOverride(boolean override) { this.override = override; }
public boolean getOverride() { return override; }
@Override
public int hashCode() {
return name.hashCode() + Boolean.valueOf(override).hashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Source other)) return false;
return name.equals(other.name) && override == other.override;
}
@Override
public String toString() {
return "source field '" + name + "'";
}
}
/** The transform to perform on the stored source */
private SummaryTransform transform;
/** The command used per field in vsmsummary */
private VsmCommand vsmCommand = VsmCommand.NONE;
private DataType dataType;
/**
* The data sources for this output summary field, in prioritized order
* (use only second source if first yields no result after transformation
* and so on). If no sources are given explicitly, the field of the same
* name as this summary field is used
*/
private Set
© 2015 - 2025 Weber Informatics LLC | Privacy Policy