Search in sources :

Example 1 with OverridableQueryProfile

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);
            }
        }
    }
}
Also used : OverridableQueryProfile(com.yahoo.search.query.profile.OverridableQueryProfile) QueryProfile(com.yahoo.search.query.profile.QueryProfile) OverridableQueryProfile(com.yahoo.search.query.profile.OverridableQueryProfile) QueryProfileVariants(com.yahoo.search.query.profile.QueryProfileVariants)

Aggregations

OverridableQueryProfile (com.yahoo.search.query.profile.OverridableQueryProfile)1 QueryProfile (com.yahoo.search.query.profile.QueryProfile)1 QueryProfileVariants (com.yahoo.search.query.profile.QueryProfileVariants)1