aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/types
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/types')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/ConversionContext.java12
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/FieldType.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/PrimitiveFieldType.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryFieldType.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileFieldType.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/types/TensorFieldType.java15
6 files changed, 13 insertions, 22 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/ConversionContext.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/ConversionContext.java
index 4aa95741b06..e5b9eb1c1cd 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/ConversionContext.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/ConversionContext.java
@@ -2,7 +2,7 @@
package com.yahoo.search.query.profile.types;
import com.yahoo.language.Language;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import java.util.Map;
@@ -13,12 +13,12 @@ import java.util.Map;
public class ConversionContext {
private final CompiledQueryProfileRegistry registry;
- private final Encoder encoder;
+ private final Embedder embedder;
private final Language language;
- public ConversionContext(CompiledQueryProfileRegistry registry, Encoder encoder, Map<String, String> context) {
+ public ConversionContext(CompiledQueryProfileRegistry registry, Embedder embedder, Map<String, String> context) {
this.registry = registry;
- this.encoder = encoder;
+ this.embedder = embedder;
this.language = context.containsKey("language") ? Language.fromLanguageTag(context.get("language"))
: Language.UNKNOWN;
}
@@ -27,14 +27,14 @@ public class ConversionContext {
CompiledQueryProfileRegistry getRegistry() {return registry;}
/** Returns the configured encoder, never null */
- Encoder getEncoder() { return encoder; }
+ Embedder getEncoder() { return embedder; }
/** Returns the language, which is never null but may be UNKNOWN */
Language getLanguage() { return language; }
/** Returns an empty context */
public static ConversionContext empty() {
- return new ConversionContext(null, Encoder.throwsOnUse, Map.of());
+ return new ConversionContext(null, Embedder.throwsOnUse, Map.of());
}
}
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 511b64c7b6e..7a06f9ef534 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
@@ -1,10 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.yahoo.language.process.Encoder;
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 com.yahoo.tensor.TensorType;
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/PrimitiveFieldType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/PrimitiveFieldType.java
index b1a9820c6fa..f9d8950908b 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/PrimitiveFieldType.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/PrimitiveFieldType.java
@@ -1,9 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.yahoo.language.process.Encoder;
import com.yahoo.search.query.profile.QueryProfileRegistry;
-import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import static com.yahoo.text.Lowercase.toLowerCase;
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryFieldType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryFieldType.java
index 09c1a4d0cc0..cbae6402039 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryFieldType.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryFieldType.java
@@ -1,9 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.yahoo.language.process.Encoder;
import com.yahoo.search.query.profile.QueryProfileRegistry;
-import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.search.yql.YqlQuery;
/**
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileFieldType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileFieldType.java
index 6958318bee4..ff12224823f 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileFieldType.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileFieldType.java
@@ -1,11 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types;
-import com.yahoo.language.process.Encoder;
import com.yahoo.search.query.profile.QueryProfile;
import com.yahoo.search.query.profile.QueryProfileRegistry;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfile;
-import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
/**
* Represents a query profile field type which is a reference to a query profile.
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 34a9f8d41c3..cd21f0b3a61 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
@@ -2,9 +2,8 @@
package com.yahoo.search.query.profile.types;
import com.yahoo.language.Language;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.search.query.profile.QueryProfileRegistry;
-import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
@@ -48,18 +47,18 @@ public class TensorFieldType extends FieldType {
return convertFrom(o, context.getEncoder(), context.getLanguage());
}
- private Object convertFrom(Object o, Encoder encoder, Language language) {
+ private Object convertFrom(Object o, Embedder embedder, Language language) {
if (o instanceof Tensor) return o;
- if (o instanceof String && ((String)o).startsWith("encode(")) return encode((String)o, encoder, language);
+ if (o instanceof String && ((String)o).startsWith("embed(")) return encode((String)o, embedder, language);
if (o instanceof String) return Tensor.from(type, (String)o);
return null;
}
- private Tensor encode(String s, Encoder encoder, Language language) {
+ private Tensor encode(String s, Embedder embedder, Language language) {
if ( ! s.endsWith(")"))
- throw new IllegalArgumentException("Expected any string enclosed in encode(), but the argument does not end by ')'");
- String text = s.substring("encode(".length(), s.length() - 1);
- return encoder.encode(text, language, type);
+ throw new IllegalArgumentException("Expected any string enclosed in embed(), but the argument does not end by ')'");
+ String text = s.substring("embed(".length(), s.length() - 1);
+ return embedder.embed(text, language, type);
}
public static TensorFieldType fromTypeString(String s) {