summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-06-09 13:00:42 +0200
committerJon Bratseth <bratseth@gmail.com>2020-06-09 13:00:42 +0200
commit8d3221cdba387a76e20ebd89ef7be5e0f8fea1ee (patch)
tree84bc26a592e13dd69751cfb7135692853206bdce /config-model
parent7f0f68d16103259bf3f2174543c6fbd3456a22fa (diff)
Disallow unbound dimensions in rank profile constants
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java6
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());
}