use of com.yahoo.search.query.profile.types.FieldType in project vespa by vespa-engine.
the class RankProfileTypeSettingsProcessor method processFieldDescription.
private void processFieldDescription(FieldDescription fieldDescription) {
String fieldName = fieldDescription.getName();
FieldType fieldType = fieldDescription.getType();
if (fieldType instanceof TensorFieldType) {
TensorFieldType tensorFieldType = (TensorFieldType) fieldType;
FeatureNames.argumentOf(fieldName).ifPresent(argument -> addQueryFeatureTypeToRankProfiles(argument, tensorFieldType.asTensorType().toString()));
}
}
use of com.yahoo.search.query.profile.types.FieldType in project vespa by vespa-engine.
the class QueryProfileXMLReader method readFieldDefinitions.
private void readFieldDefinitions(Element element, QueryProfileType type, QueryProfileTypeRegistry registry) {
for (Element field : XML.getChildren(element, "field")) {
String name = field.getAttribute("name");
if (name == null || name.equals(""))
throw new IllegalArgumentException("A field has no 'name' attribute");
try {
String fieldTypeName = field.getAttribute("type");
if (fieldTypeName == null)
throw new IllegalArgumentException("Field '" + field + "' has no 'type' attribute");
FieldType fieldType = FieldType.fromString(fieldTypeName, registry);
type.addField(new FieldDescription(name, fieldType, field.getAttribute("alias"), getBooleanAttribute("mandatory", false, field), getBooleanAttribute("overridable", true, field)), registry);
} catch (RuntimeException e) {
throw new IllegalArgumentException("Invalid field '" + name + "'", e);
}
}
}
use of com.yahoo.search.query.profile.types.FieldType in project vespa by vespa-engine.
the class QueryProfileConfigurer method instantiateFieldDescription.
private static void instantiateFieldDescription(QueryProfilesConfig.Queryprofiletype.Field fieldConfig, QueryProfileType type, QueryProfileTypeRegistry registry) {
try {
FieldType fieldType = FieldType.fromString(fieldConfig.type(), registry);
FieldDescription field = new FieldDescription(fieldConfig.name(), fieldType, fieldConfig.alias(), fieldConfig.mandatory(), fieldConfig.overridable());
type.addField(field, registry);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid field '" + fieldConfig.name() + "' in " + type, e);
}
}
Aggregations