From ff42200912e298bb8d4f29da8d18c8b0079b04b7 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Mon, 5 Feb 2018 13:20:28 +0100 Subject: Use all query profiles and handle conflicts --- .../com/yahoo/search/query/profile/types/FieldDescription.java | 1 + .../main/java/com/yahoo/search/query/profile/types/FieldType.java | 7 +++++++ .../java/com/yahoo/search/query/profile/types/TensorFieldType.java | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'container-search/src/main/java/com/yahoo') diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java index 6be0dac6448..e8d8ecb02bb 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldDescription.java @@ -4,6 +4,7 @@ package com.yahoo.search.query.profile.types; import com.google.common.collect.ImmutableList; import com.yahoo.processing.request.CompoundName; import com.yahoo.search.query.profile.QueryProfile; +import com.yahoo.tensor.TensorType; import java.util.Arrays; import java.util.Collections; diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java index 69c07843681..3bfd33668e6 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java @@ -6,6 +6,7 @@ import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry; import com.yahoo.search.yql.YqlQuery; import com.yahoo.tensor.Tensor; +import com.yahoo.tensor.TensorType; /** * Superclass of query type field types. @@ -42,6 +43,12 @@ public abstract class FieldType { /** Converts the given type to an instance of this type, if possible. Returns null if not possible. */ public abstract Object convertFrom(Object o, CompiledQueryProfileRegistry registry); + /** + * Returns this type as a tensor type: The true tensor type is this is a tensor field an an empty type - + * interpreted as a double in numerical contexts - otherwise + */ + public TensorType asTensorType() { return TensorType.empty; } + /** * Returns the field type for a given string name. * diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java index 53ab7aefafd..9699a72cb31 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java @@ -21,7 +21,8 @@ public class TensorFieldType extends FieldType { } /** Returns information about the type of tensor this will hold */ - public TensorType type() { return type; } + @Override + public TensorType asTensorType() { return type; } @Override public Class getValueClass() { return Tensor.class; } -- cgit v1.2.3