diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-03-30 17:22:08 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-03-30 17:22:08 +0200 |
commit | c0cd66e75bd5a8ff5cd94a72529cb951a1046746 (patch) | |
tree | 739856a9eb2ba3069f6427b9aa562ff6ad8376df /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java | |
parent | 211fdb61ecf7379c8113e0da413a8cc16f72494d (diff) |
Support substitutions in tensors
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java index c30a78da57d..989f12172b3 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java @@ -477,22 +477,6 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable } } - /** Returns this value, or its corresponding substitution string if it contains substitutions */ - protected Object convertToSubstitutionString(Object value) { - if (value == null) return value; - if (value.getClass() != String.class) return value; - SubstituteString substituteString = SubstituteString.create((String)value); - if (substituteString == null) return value; - return substituteString; - } - - /** Returns the field description of this field, or null if it is not typed */ - protected FieldDescription getFieldDescription(CompoundName name, DimensionBinding binding) { - FieldDescriptionQueryProfileVisitor visitor = new FieldDescriptionQueryProfileVisitor(name.asList()); - accept(visitor, binding, null); - return visitor.result(); - } - /** * Returns true if this value is definitely overridable in this (set and not unoverridable), * false if it is declared unoverridable (in instance or type), and null if this profile has no @@ -620,6 +604,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable if (parentType != null && type == null && ! isFrozen()) type = parentType; + value = convertToSubstitutionString(value); value = checkAndConvertAssignment(localName, value, registry); localPut(localName, value, dimensionBinding); return this; @@ -841,7 +826,6 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable localName = type.unalias(localName); validateName(localName); - value = convertToSubstitutionString(value); if (dimensionBinding.isNull()) { Object combinedValue = value instanceof QueryProfile @@ -857,6 +841,15 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable } } + /** Returns this value, or its corresponding substitution string if it contains substitutions */ + static Object convertToSubstitutionString(Object value) { + if (value == null) return value; + if (value.getClass() != String.class) return value; + SubstituteString substituteString = SubstituteString.create((String)value); + if (substituteString == null) return value; + return substituteString; + } + private static final Pattern namePattern = Pattern.compile("[$a-zA-Z_/][-$a-zA-Z0-9_/()]*"); /** |