summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-02-06 17:04:00 +0100
committerJon Bratseth <bratseth@oath.com>2018-02-06 17:04:00 +0100
commitd0eeb393e656e6ce5b1f461e802573e9ec145e72 (patch)
tree91e6bae506cee6173019236fe9b51d7462e1652c
parentcb18a346ddb89b604251564f59968d4d62b065a3 (diff)
Don't include output name when type checking
-rwxr-xr-xsearchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java
index cd4eb21d1f2..b9b377dc0ec 100755
--- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java
@@ -60,6 +60,10 @@ public final class ReferenceNode extends CompositeNode {
@Override
public String toString(SerializationContext context, Deque<String> path, CompositeNode parent) {
+ return toString(context, path, true);
+ }
+
+ private String toString(SerializationContext context, Deque<String> path, boolean includeOutput) {
if (path == null)
path = new ArrayDeque<>();
String myName = this.name;
@@ -101,14 +105,18 @@ public final class ReferenceNode extends CompositeNode {
}
ret.append(")");
}
- ret.append(myOutput != null ? "." + myOutput : "");
+ if (includeOutput)
+ ret.append(myOutput != null ? "." + myOutput : "");
return ret.toString();
}
@Override
public TensorType type(TypeContext context) {
- // Don't support outputs of different type, for simplicity
- TensorType type = context.getType(toString());
+ // Ensure base name (excluding output exists,
+ // but don't support outputs of different tensor types (not used, so no need)
+ String name = toString(new SerializationContext(), null, false);
+ TensorType type = context.getType(name);
+
if (type == null)
throw new IllegalArgumentException("Unknown feature '" + toString() + "'");
return type;