diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-11-10 23:32:31 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-11-10 23:32:31 +0100 |
commit | 094be744d6706e02c7299ac1c92b49a0b13a24c5 (patch) | |
tree | 297d1df9650694c26fc11aceff5444ed445e9096 /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java | |
parent | 0c68b00b2d3a9ddc191ed1733ba2f8699d1c3dc1 (diff) |
Support setting specific variants unoverridable
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java index 062b9d8c6e4..431947b0816 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java @@ -27,7 +27,7 @@ public class QueryProfileVariants implements Freezable, Cloneable { private boolean frozen = false; /** Properties indexed by name, to support fast lookup of single values */ - private Map<String,FieldValues> fieldValuesByName = new HashMap<>(); + private Map<String, FieldValues> fieldValuesByName = new HashMap<>(); /** The inherited profiles for various dimensions settings - a set of fieldvalues of List<QueryProfile> */ private FieldValues inheritedProfiles = new FieldValues(); @@ -233,6 +233,19 @@ public class QueryProfileVariants implements Freezable, Cloneable { } /** + * Makes a value unoverridable in a given context. + */ + public void setOverridable(String fieldName, boolean overridable, DimensionValues dimensionValues) { + getVariant(dimensionValues, true).setOverridable(fieldName, overridable); + } + + public Boolean isOverridable(String fieldName, DimensionValues dimensionValues) { + QueryProfileVariant variant = getVariant(dimensionValues, false); + if (variant == null) return null; + return variant.isOverridable(fieldName); + } + + /** * Returns the dimensions over which the virtual profiles in this may return different values. * Each dimension is a name for which a key-value may be supplied in the context properties * on lookup time to influence the value returned. |