aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-09-20 23:07:57 +0200
committerJon Bratseth <bratseth@gmail.com>2021-09-20 23:07:57 +0200
commitb6a9601be1f287f8efa1398aabffa4efe0a796cd (patch)
tree10c371df6b1b19e19071a9a150fe6864e777b67f /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
parent304fc2ea70fd82957565416554bfed190353d643 (diff)
Encode tensors passed as encode(text)
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
index 34fe376150d..e555000272d 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
@@ -2,14 +2,15 @@
package com.yahoo.search.query.profile;
import com.yahoo.collections.Pair;
+import com.yahoo.language.process.Encoder;
import com.yahoo.processing.IllegalInputException;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.processing.request.properties.PropertyMap;
import com.yahoo.protect.Validator;
-import com.yahoo.search.Query;
import com.yahoo.search.query.Properties;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfile;
import com.yahoo.search.query.profile.compiled.DimensionalValue;
+import com.yahoo.search.query.profile.types.ConversionContext;
import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileFieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;
@@ -29,6 +30,7 @@ import java.util.Map;
public class QueryProfileProperties extends Properties {
private final CompiledQueryProfile profile;
+ private final Encoder encoder;
// Note: The priority order is: values has precedence over references
@@ -42,10 +44,15 @@ public class QueryProfileProperties extends Properties {
*/
private List<Pair<CompoundName, CompiledQueryProfile>> references = null;
- /** Creates an instance from a profile, throws an exception if the given profile is null */
public QueryProfileProperties(CompiledQueryProfile profile) {
+ this(profile, Encoder.throwsOnUse);
+ }
+
+ /** Creates an instance from a profile, throws an exception if the given profile is null */
+ public QueryProfileProperties(CompiledQueryProfile profile, Encoder encoder) {
Validator.ensureNotNull("The profile wrapped by this cannot be null", profile);
this.profile = profile;
+ this.encoder = encoder;
}
/** Returns the query profile backing this, or null if none */
@@ -114,7 +121,9 @@ public class QueryProfileProperties extends Properties {
if (fieldDescription != null) {
if (i == name.size() - 1) { // at the end of the path, check the assignment type
- value = fieldDescription.getType().convertFrom(value, profile.getRegistry());
+ value = fieldDescription.getType().convertFrom(value, new ConversionContext(profile.getRegistry(),
+ encoder,
+ context));
if (value == null)
throw new IllegalInputException("'" + value + "' is not a " +
fieldDescription.getType().toInstanceDescription());