diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-11-10 20:59:00 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-11-10 20:59:00 +0100 |
commit | 15b3db0dfa32b87df0e24a968335ccf5d690ed16 (patch) | |
tree | a7b3fc8458a6cb3e621fa084f4b3f6f94b834a09 /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java | |
parent | b26cbb29aec75b76767e6e1631eae2a11f035823 (diff) |
Don't interpret ref: as a query profile ref unnecessarily
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java index f5d797b4b9f..f73ed52246c 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java @@ -139,14 +139,15 @@ public class QueryProfileProperties extends Properties { if ( ! profile.getTypes().isEmpty()) value = convertByType(name, value, context); + // TODO: On Vespa 9, only support this when the profile is typed and this field has a query profile type if (value instanceof String && value.toString().startsWith("ref:")) { if (profile.getRegistry() == null) throw new IllegalInputException("Runtime query profile references does not work when the " + "QueryProfileProperties are constructed without a registry"); String queryProfileId = value.toString().substring(4); - value = profile.getRegistry().findQueryProfile(queryProfileId); - if (value == null) - throw new IllegalInputException("Query profile '" + queryProfileId + "' is not found"); + var referencedProfile = profile.getRegistry().findQueryProfile(queryProfileId); + if (referencedProfile != null) + value = referencedProfile; } if (set) { @@ -168,6 +169,7 @@ public class QueryProfileProperties extends Properties { } private String toShortString(Object value) { + if (value == null) return "null"; if ( ! (value instanceof Tensor)) return value.toString(); return ((Tensor)value).toAbbreviatedString(); } |