diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-06-09 13:00:42 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-06-09 13:00:42 +0200 |
commit | 8d3221cdba387a76e20ebd89ef7be5e0f8fea1ee (patch) | |
tree | 84bc26a592e13dd69751cfb7135692853206bdce | |
parent | 7f0f68d16103259bf3f2174543c6fbd3456a22fa (diff) |
Disallow unbound dimensions in rank profile constants
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java index 8b2a190feb9..d309f48d6df 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java @@ -304,6 +304,12 @@ public class RankProfile implements Cloneable { } public void addConstant(String name, Value value) { + if (value instanceof TensorValue) { + TensorType type = ((TensorValue)value).type(); + if (type.dimensions().stream().anyMatch(d -> d.isIndexed() && d.size().isEmpty())) + throw new IllegalArgumentException("Illegal type of constant " + name + " type " + type + + ": Dense tensor dimensions must have a size"); + } constants.put(name, value.freeze()); } |