use of com.yahoo.search.query.profile.OverridableQueryProfile in project vespa by vespa-engine.
the class DeclaredQueryProfileVariants method dereferenceCompoundedVariants.
private void dereferenceCompoundedVariants(QueryProfile profile, String prefix) {
// having the variants
for (Map.Entry<String, Object> entry : profile.declaredContent().entrySet()) {
if (!(entry.getValue() instanceof QueryProfile))
continue;
QueryProfile subProfile = (QueryProfile) entry.getValue();
// Export if defined implicitly in this, or if this contains overrides
if (!subProfile.isExplicit() || subProfile instanceof OverridableQueryProfile) {
String entryPrefix = prefix + entry.getKey() + ".";
dereferenceCompoundedVariants(subProfile.getVariants(), entryPrefix);
dereferenceCompoundedVariants(subProfile, entryPrefix);
}
}
if (profile.getVariants() == null)
return;
// We need to do the same dereferencing to overridables pointed to by variants of this
for (Map.Entry<String, QueryProfileVariants.FieldValues> fieldValueEntry : profile.getVariants().getFieldValues().entrySet()) {
for (QueryProfileVariants.FieldValue fieldValue : fieldValueEntry.getValue().asList()) {
if (!(fieldValue.getValue() instanceof QueryProfile))
continue;
QueryProfile subProfile = (QueryProfile) fieldValue.getValue();
// Export if defined implicitly in this, or if this contains overrides
if (!subProfile.isExplicit() || subProfile instanceof OverridableQueryProfile) {
String entryPrefix = prefix + fieldValueEntry.getKey() + ".";
dereferenceCompoundedVariants(subProfile.getVariants(), entryPrefix);
dereferenceCompoundedVariants(subProfile, entryPrefix);
}
}
}
}
Aggregations