summaryrefslogtreecommitdiffstats
path: root/container-search/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java5
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java20
2 files changed, 7 insertions, 18 deletions
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 bb0498e0512..acefa26930a 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
@@ -5,9 +5,6 @@ import com.yahoo.search.query.profile.QueryProfile;
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 java.util.Optional;
/**
* Superclass of query type field types.
@@ -24,7 +21,6 @@ public abstract class FieldType {
public static final PrimitiveFieldType floatType = new PrimitiveFieldType(Float.class);
public static final PrimitiveFieldType doubleType = new PrimitiveFieldType(Double.class);
public static final PrimitiveFieldType booleanType = new PrimitiveFieldType(Boolean.class);
- public static final TensorFieldType genericTensorType = new TensorFieldType(Optional.empty());
public static final QueryFieldType queryType = new QueryFieldType();
public static final QueryProfileFieldType genericQueryProfileType = new QueryProfileFieldType();
@@ -85,7 +81,6 @@ public abstract class FieldType {
if (clazz == Float.class) return floatType;
if (clazz == Double.class) return doubleType;
if (clazz == Boolean.class) return booleanType;
- if (clazz == Tensor.class) return genericTensorType;
if (clazz == YqlQuery.class) return queryType;
if (clazz == QueryProfile.class) return genericQueryProfileType;
return null;
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 0fd529bf262..6bda518f0cd 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
@@ -6,8 +6,6 @@ import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
-import java.util.Optional;
-
/**
* A tensor field type in a query profile
*
@@ -15,17 +13,15 @@ import java.util.Optional;
*/
public class TensorFieldType extends FieldType {
- // TODO: Require tensor type
-
- private final Optional<TensorType> type;
+ private final TensorType type;
- /** Creates a tensor field type with optional information about the kind of tensor this will hold */
- public TensorFieldType(Optional<TensorType> type) {
+ /** Creates a tensor field type with information about the kind of tensor this will hold */
+ public TensorFieldType(TensorType type) {
this.type = type;
}
- /** Returns information about the type of tensor this will hold, or empty to allow any kind of tensor */
- public Optional<TensorType> type() { return type; }
+ /** Returns information about the type of tensor this will hold */
+ public TensorType type() { return type; }
@Override
public Class getValueClass() { return Tensor.class; }
@@ -42,7 +38,7 @@ public class TensorFieldType extends FieldType {
@Override
public Object convertFrom(Object o, QueryProfileRegistry registry) {
if (o instanceof Tensor) return o;
- if (o instanceof String) return type.isPresent() ? Tensor.from(type.get(), (String)o) : Tensor.from((String)o);
+ if (o instanceof String) return Tensor.from(type, (String)o);
return null;
}
@@ -52,9 +48,7 @@ public class TensorFieldType extends FieldType {
}
public static TensorFieldType fromTypeString(String s) {
- if (s.equals("tensor")) return genericTensorType;
- return new TensorFieldType(Optional.of(TensorType.fromSpec(s)));
+ return new TensorFieldType(TensorType.fromSpec(s));
}
-
}