diff options
author | Arne Juul <arnej@vespa.ai> | 2024-02-21 14:31:27 +0000 |
---|---|---|
committer | Arne Juul <arnej@vespa.ai> | 2024-02-22 10:36:19 +0000 |
commit | 97eff1f15dcafe4a8d0229fa36b3e0448de2f4d6 (patch) | |
tree | 7bfa620f51263b3e2c6cc1bd319b922a0cb33a09 /container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java | |
parent | 4f0947b6617f5c9ff0a133a1f12bb4a5b7d57bb6 (diff) |
allow inputs { query(foo) string }
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java index 82e1409c4eb..ea2120dae3f 100644 --- a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java +++ b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java @@ -6,6 +6,8 @@ import com.yahoo.language.process.Embedder; import com.yahoo.processing.IllegalInputException; import com.yahoo.processing.request.CompoundName; import com.yahoo.search.Query; +import com.yahoo.search.schema.RankProfile; +import com.yahoo.search.schema.RankProfile.InputType; import com.yahoo.search.schema.SchemaInfo; import com.yahoo.search.schema.internal.TensorConverter; import com.yahoo.search.query.Properties; @@ -39,9 +41,16 @@ public class RankProfileInputProperties extends Properties { public void set(CompoundName name, Object value, Map<String, String> context) { if (RankFeatures.isFeatureName(name.toString())) { try { - TensorType expectedType = typeOf(name); - if (expectedType != null) { - value = tensorConverter.convertTo(expectedType, + var expectedType = typeOf(name); + System.err.println("setting rank feature '" + name + "' -> " + value + " :: " + value.getClass()); + if (expectedType != null && expectedType.declaredString()) { + System.err.println("expected type: declared string"); + var e = new IllegalArgumentException("foo"); + e.fillInStackTrace(); + e.printStackTrace(); + } + if (expectedType != null && ! expectedType.declaredString()) { + value = tensorConverter.convertTo(expectedType.tensorType(), name.last(), value, query.getModel().getLanguage(), @@ -59,14 +68,14 @@ public class RankProfileInputProperties extends Properties { @Override public void requireSettable(CompoundName name, Object value, Map<String, String> context) { if (RankFeatures.isFeatureName(name.toString())) { - TensorType expectedType = typeOf(name); - if (expectedType != null) - verifyType(name, value, expectedType); + var expectedType = typeOf(name); + if (expectedType != null && ! expectedType.declaredString()) + verifyType(name, value, expectedType.tensorType()); } super.requireSettable(name, value, context); } - private TensorType typeOf(CompoundName name) { + private RankProfile.InputType typeOf(CompoundName name) { // Session is lazily resolved because order matters: // model.sources+restrict must be set in the query before this is done if (session == null) |