Search in sources :

Example 1 with BackedOverridableQueryProfile

use of com.yahoo.search.query.profile.BackedOverridableQueryProfile in project vespa by vespa-engine.

the class QueryProfiles method addField.

private void addField(QueryProfilesConfig.Queryprofile.Builder qpB, QueryProfile profile, Entry<String, Object> field, String namePrefix) {
    String fullName = namePrefix + field.getKey();
    if (field.getValue() instanceof QueryProfile) {
        QueryProfile subProfile = (QueryProfile) field.getValue();
        if (!subProfile.isExplicit()) {
            // Implicitly defined profile - add content
            addFieldChildren(qpB, subProfile, fullName + ".");
        } else {
            // Reference to an id'ed profile - output reference plus any local overrides
            QueryProfilesConfig.Queryprofile.Reference.Builder refB = new QueryProfilesConfig.Queryprofile.Reference.Builder();
            createReferenceFieldConfig(refB, profile, fullName, field.getKey(), ((BackedOverridableQueryProfile) subProfile).getBacking().getId().stringValue());
            qpB.reference(refB);
            addFieldChildren(qpB, subProfile, fullName + ".");
        }
    } else {
        // a primitive
        qpB.property(createPropertyFieldConfig(profile, fullName, field.getKey(), field.getValue()));
    }
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) QueryProfilesConfig(com.yahoo.search.query.profile.config.QueryProfilesConfig) SubstituteString(com.yahoo.search.query.profile.SubstituteString)

Example 2 with BackedOverridableQueryProfile

use of com.yahoo.search.query.profile.BackedOverridableQueryProfile in project vespa by vespa-engine.

the class QueryProfiles method addVariantField.

private void addVariantField(QueryProfilesConfig.Queryprofile.Queryprofilevariant.Builder qpB, Entry<String, Object> field, String namePrefix) {
    String fullName = namePrefix + field.getKey();
    if (field.getValue() instanceof QueryProfile) {
        QueryProfile subProfile = (QueryProfile) field.getValue();
        if (!subProfile.isExplicit()) {
            // Implicitly defined profile - add content
            addVariantFieldChildren(qpB, subProfile, fullName + ".");
        } else {
            // Reference to an id'ed profile - output reference plus any local overrides
            QueryProfilesConfig.Queryprofile.Queryprofilevariant.Reference.Builder refB = new QueryProfilesConfig.Queryprofile.Queryprofilevariant.Reference.Builder();
            createVariantReferenceFieldConfig(refB, fullName, ((BackedOverridableQueryProfile) subProfile).getBacking().getId().stringValue());
            qpB.reference(refB);
            addVariantFieldChildren(qpB, subProfile, fullName + ".");
        }
    } else {
        // a primitive
        qpB.property(createVariantPropertyFieldConfig(fullName, field.getValue()));
    }
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) BackedOverridableQueryProfile(com.yahoo.search.query.profile.BackedOverridableQueryProfile) QueryProfilesConfig(com.yahoo.search.query.profile.config.QueryProfilesConfig) SubstituteString(com.yahoo.search.query.profile.SubstituteString)

Aggregations

BackedOverridableQueryProfile (com.yahoo.search.query.profile.BackedOverridableQueryProfile)2 QueryProfile (com.yahoo.search.query.profile.QueryProfile)2 SubstituteString (com.yahoo.search.query.profile.SubstituteString)2 QueryProfilesConfig (com.yahoo.search.query.profile.config.QueryProfilesConfig)2