diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-04-28 20:52:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 20:52:15 +0200 |
commit | e0c3677ad6674b8452ba07e85e9b07fa7858b73e (patch) | |
tree | 4caa387b0fe97af7dce997abad839625d138ebbc /config-model/src/main | |
parent | c1f94ef7e3f9cdfc2fbcb65812c95c742aed3c56 (diff) | |
parent | 2ee3e1d2e9fdda8d10a91e616e3a4f8d758d7dbe (diff) |
Merge pull request #17641 from vespa-engine/bratseth/query-profile-references
Use owner's dimensions in BackedOverridableQueryProfile
Diffstat (limited to 'config-model/src/main')
2 files changed, 20 insertions, 19 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/DeclaredQueryProfileVariants.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/DeclaredQueryProfileVariants.java index c3fea385e8d..ab9f51ff0ad 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/DeclaredQueryProfileVariants.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/DeclaredQueryProfileVariants.java @@ -15,7 +15,7 @@ import java.util.*; */ public class DeclaredQueryProfileVariants { - private final Map<String, VariantQueryProfile> variantQueryProfiles =new LinkedHashMap<>(); + private final Map<String, VariantQueryProfile> variantQueryProfiles = new LinkedHashMap<>(); public DeclaredQueryProfileVariants(QueryProfile profile) { // Recreates the declared view (settings per set of dimensions) @@ -67,26 +67,26 @@ public class DeclaredQueryProfileVariants { // having the variants for (Map.Entry<String,Object> entry : profile.declaredContent().entrySet()) { if ( ! (entry.getValue() instanceof QueryProfile)) continue; - QueryProfile subProfile=(QueryProfile)entry.getValue(); + 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); + String entryPrefix = prefix + entry.getKey() + "."; + dereferenceCompoundedVariants(subProfile.getVariants(), entryPrefix); + dereferenceCompoundedVariants(subProfile, entryPrefix); } } - if (profile.getVariants()==null) return; + 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(); + 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); + String entryPrefix = prefix + fieldValueEntry.getKey() + "."; + dereferenceCompoundedVariants(subProfile.getVariants(), entryPrefix); + dereferenceCompoundedVariants(subProfile, entryPrefix); } } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java index 3227646041a..e5ed20e19ec 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/QueryProfiles.java @@ -65,12 +65,13 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer if ( registry.getTypeRegistry().hasApplicationTypes() && registry.allComponents().isEmpty()) { logger.logApplicationPackage(Level.WARNING, "This application define query profile types, but has " + - "no query profiles referencing them so they have no effect. " + - (tensorFields.isEmpty() - ? "" - : "In particular, the tensors (" + String.join(", ", tensorFields) + - ") will be interpreted as strings, not tensors if sent in requests. ") + - "See https://docs.vespa.ai/en/query-profiles.html"); + "no query profiles referencing them so they have no effect. " + + (tensorFields.isEmpty() ? "" + : "In particular, the tensors (" + + String.join(", ", tensorFields) + + ") will be interpreted as strings, " + + "not tensors if sent in requests. ") + + "See https://docs.vespa.ai/en/query-profiles.html"); } } @@ -100,7 +101,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer for (QueryProfile inherited : profile.inherited()) qB.inherit(inherited.getId().stringValue()); - if (profile.getVariants()!=null) { + if (profile.getVariants() != null) { for (String dimension : profile.getVariants().getDimensions()) qB.dimensions(dimension); } @@ -180,7 +181,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer 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 + "."); + addVariantFieldChildren(qpB, subProfile, fullName + "."); } } else { // a primitive @@ -208,7 +209,7 @@ public class QueryProfiles implements Serializable, QueryProfilesConfig.Producer } qB.queryprofilevariant(varB); } - } + } private void createReferenceFieldConfig(QueryProfilesConfig.Queryprofile.Reference.Builder refB, QueryProfile profile, String fullName, String localName, String stringValue) { |