From 97eff1f15dcafe4a8d0229fa36b3e0448de2f4d6 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 21 Feb 2024 14:31:27 +0000 Subject: allow inputs { query(foo) string } --- .../src/main/java/com/yahoo/schema/RankProfile.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'config-model/src/main/java/com/yahoo/schema/RankProfile.java') diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfile.java b/config-model/src/main/java/com/yahoo/schema/RankProfile.java index 9b3e236612a..22bf1880cd7 100644 --- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java @@ -17,6 +17,7 @@ import com.yahoo.schema.expressiontransforms.ExpressionTransforms; import com.yahoo.schema.expressiontransforms.RankProfileTransformContext; import com.yahoo.schema.expressiontransforms.InputRecorder; import com.yahoo.schema.parser.ParseException; +import com.yahoo.search.schema.RankProfile.InputType; import com.yahoo.searchlib.rankingexpression.ExpressionFunction; import com.yahoo.searchlib.rankingexpression.FeatureList; import com.yahoo.searchlib.rankingexpression.RankingExpression; @@ -841,7 +842,7 @@ public class RankProfile implements Cloneable { if (inputs.containsKey(reference)) { Input existing = inputs().get(reference); if (! input.equals(existing)) - throw new IllegalArgumentException("Duplicate input: Has both " + input + " and existing"); + throw new IllegalArgumentException("Duplicate input: Has both " + input + " and existing " + existing); } inputs.put(reference, input); } @@ -1177,7 +1178,8 @@ public class RankProfile implements Cloneable { private Map featureTypes() { Map featureTypes = inputs().values().stream() - .collect(Collectors.toMap(input -> input.name(), input -> input.type())); + .collect(Collectors.toMap(input -> input.name(), + input -> input.type().tensorType())); allFields().forEach(field -> addAttributeFeatureTypes(field, featureTypes)); allImportedFields().forEach(field -> addAttributeFeatureTypes(field, featureTypes)); return featureTypes; @@ -1545,17 +1547,21 @@ public class RankProfile implements Cloneable { public static final class Input { private final Reference name; - private final TensorType type; + private final InputType type; private final Optional defaultValue; - public Input(Reference name, TensorType type, Optional defaultValue) { + public Input(Reference name, InputType type, Optional defaultValue) { this.name = name; this.type = type; this.defaultValue = defaultValue; } + public Input(Reference name, TensorType tType, Optional defaultValue) { + this(name, new InputType(tType, false), defaultValue); + } + public Reference name() { return name; } - public TensorType type() { return type; } + public InputType type() { return type; } public Optional defaultValue() { return defaultValue; } @Override -- cgit v1.2.3