use of com.yahoo.search.query.profile.SubstituteString in project vespa by vespa-engine.
the class QueryProfiles method addVariantFieldChildren.
private void addVariantFieldChildren(QueryProfilesConfig.Queryprofile.Queryprofilevariant.Builder qpB, QueryProfile profile, String namePrefix) {
List<Map.Entry<String, Object>> content = new ArrayList<>(profile.declaredContent().entrySet());
Collections.sort(content, new MapEntryKeyComparator());
if (profile.getValue() != null) {
// Add "prefix with dot removed"=value:
QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder propB = new QueryProfilesConfig.Queryprofile.Queryprofilevariant.Property.Builder();
String fullName = namePrefix.substring(0, namePrefix.length() - 1);
Object value = profile.getValue();
if (value instanceof SubstituteString)
// Send only types understood by configBuilder downwards
value = value.toString();
propB.name(fullName);
if (value != null)
propB.value(value.toString());
qpB.property(propB);
}
for (Map.Entry<String, Object> field : content) {
addVariantField(qpB, field, namePrefix);
}
}
use of com.yahoo.search.query.profile.SubstituteString in project vespa by vespa-engine.
the class QueryProfiles method addFieldChildren.
private void addFieldChildren(QueryProfilesConfig.Queryprofile.Builder qpB, QueryProfile profile, String namePrefix) {
List<Map.Entry<String, Object>> content = new ArrayList<>(profile.declaredContent().entrySet());
Collections.sort(content, new MapEntryKeyComparator());
if (profile.getValue() != null) {
// Add "prefix with dot removed"=value:
QueryProfilesConfig.Queryprofile.Property.Builder propB = new QueryProfilesConfig.Queryprofile.Property.Builder();
String fullName = namePrefix.substring(0, namePrefix.length() - 1);
Object value = profile.getValue();
if (value instanceof SubstituteString)
// Send only types understood by configBuilder downwards
value = value.toString();
propB.name(fullName);
if (value != null)
propB.value(value.toString());
qpB.property(propB);
}
for (Map.Entry<String, Object> field : content) {
addField(qpB, profile, field, namePrefix);
}
}
Aggregations