aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
Diffstat (limited to 'container-search')
-rw-r--r--container-search/abi-spec.json12
-rw-r--r--container-search/src/main/java/com/yahoo/search/Query.java26
-rw-r--r--container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java20
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java12
-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
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java10
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java (renamed from container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEncoderTestCase.java)2
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java27
13 files changed, 67 insertions, 77 deletions
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json
index 7016eff3185..40071f90c34 100644
--- a/container-search/abi-spec.json
+++ b/container-search/abi-spec.json
@@ -1801,8 +1801,8 @@
"public java.util.Map getRequestMap()",
"public com.yahoo.search.Query$Builder setQueryProfile(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)",
"public com.yahoo.search.query.profile.compiled.CompiledQueryProfile getQueryProfile()",
- "public com.yahoo.search.Query$Builder setEncoder(com.yahoo.language.process.Encoder)",
- "public com.yahoo.language.process.Encoder getEncoder()",
+ "public com.yahoo.search.Query$Builder setEmbedder(com.yahoo.language.process.Embedder)",
+ "public com.yahoo.language.process.Embedder getEmbedder()",
"public com.yahoo.search.Query build()"
],
"fields": []
@@ -4258,7 +4258,7 @@
"public"
],
"methods": [
- "public void <init>(com.yahoo.statistics.Statistics, com.yahoo.jdisc.Metric, com.yahoo.container.handler.threadpool.ContainerThreadPool, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.container.core.ContainerHttpConfig, com.yahoo.language.process.Encoder, com.yahoo.search.searchchain.ExecutionFactory)",
+ "public void <init>(com.yahoo.statistics.Statistics, com.yahoo.jdisc.Metric, com.yahoo.container.handler.threadpool.ContainerThreadPool, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.container.core.ContainerHttpConfig, com.yahoo.language.process.Embedder, com.yahoo.search.searchchain.ExecutionFactory)",
"public void <init>(com.yahoo.statistics.Statistics, com.yahoo.jdisc.Metric, com.yahoo.container.handler.threadpool.ContainerThreadPool, com.yahoo.container.logging.AccessLog, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.container.core.ContainerHttpConfig, com.yahoo.search.searchchain.ExecutionFactory)",
"public void <init>(com.yahoo.statistics.Statistics, com.yahoo.jdisc.Metric, java.util.concurrent.Executor, com.yahoo.container.logging.AccessLog, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.container.core.ContainerHttpConfig, com.yahoo.search.searchchain.ExecutionFactory)",
"public void <init>(com.yahoo.statistics.Statistics, com.yahoo.jdisc.Metric, java.util.concurrent.Executor, com.yahoo.container.logging.AccessLog, com.yahoo.search.query.profile.config.QueryProfilesConfig, com.yahoo.container.core.ContainerHttpConfig, com.yahoo.search.searchchain.ExecutionFactory)",
@@ -5885,7 +5885,7 @@
],
"methods": [
"public void <init>(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)",
- "public void <init>(com.yahoo.search.query.profile.compiled.CompiledQueryProfile, com.yahoo.language.process.Encoder)",
+ "public void <init>(com.yahoo.search.query.profile.compiled.CompiledQueryProfile, com.yahoo.language.process.Embedder)",
"public com.yahoo.search.query.profile.compiled.CompiledQueryProfile getQueryProfile()",
"public java.lang.Object get(com.yahoo.processing.request.CompoundName, java.util.Map, com.yahoo.processing.request.Properties)",
"public void set(com.yahoo.processing.request.CompoundName, java.lang.Object, java.util.Map)",
@@ -6259,7 +6259,7 @@
"public"
],
"methods": [
- "public void <init>(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.language.process.Encoder, java.util.Map)",
+ "public void <init>(com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.language.process.Embedder, java.util.Map)",
"public static com.yahoo.search.query.profile.types.ConversionContext empty()"
],
"fields": []
@@ -6531,7 +6531,7 @@
"public"
],
"methods": [
- "public void <init>(com.yahoo.search.Query, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.language.process.Encoder)",
+ "public void <init>(com.yahoo.search.Query, com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry, com.yahoo.language.process.Embedder)",
"public void setParentQuery(com.yahoo.search.Query)",
"public java.lang.Object get(com.yahoo.processing.request.CompoundName, java.util.Map, com.yahoo.processing.request.Properties)",
"public void set(com.yahoo.processing.request.CompoundName, java.lang.Object, java.util.Map)",
diff --git a/container-search/src/main/java/com/yahoo/search/Query.java b/container-search/src/main/java/com/yahoo/search/Query.java
index 06b71599103..08ebd74da5a 100644
--- a/container-search/src/main/java/com/yahoo/search/Query.java
+++ b/container-search/src/main/java/com/yahoo/search/Query.java
@@ -7,7 +7,7 @@ import com.yahoo.collections.Tuple2;
import com.yahoo.component.Version;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.fs4.MapEncoder;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.prelude.fastsearch.DocumentDatabase;
import com.yahoo.prelude.query.Highlight;
import com.yahoo.prelude.query.textualrepresentation.TextualQueryRepresentation;
@@ -334,32 +334,32 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
public Query(HttpRequest request, Map<String, String> requestMap, CompiledQueryProfile queryProfile) {
super(new QueryPropertyAliases(propertyAliases));
this.httpRequest = request;
- init(requestMap, queryProfile, Encoder.throwsOnUse);
+ init(requestMap, queryProfile, Embedder.throwsOnUse);
}
// TODO: Deprecate most constructors above here
private Query(Builder builder) {
- this(builder.getRequest(), builder.getRequestMap(), builder.getQueryProfile(), builder.getEncoder());
+ this(builder.getRequest(), builder.getRequestMap(), builder.getQueryProfile(), builder.getEmbedder());
}
- private Query(HttpRequest request, Map<String, String> requestMap, CompiledQueryProfile queryProfile, Encoder encoder) {
+ private Query(HttpRequest request, Map<String, String> requestMap, CompiledQueryProfile queryProfile, Embedder embedder) {
super(new QueryPropertyAliases(propertyAliases));
this.httpRequest = request;
- init(requestMap, queryProfile, encoder);
+ init(requestMap, queryProfile, embedder);
}
- private void init(Map<String, String> requestMap, CompiledQueryProfile queryProfile, Encoder encoder) {
+ private void init(Map<String, String> requestMap, CompiledQueryProfile queryProfile, Embedder embedder) {
startTime = httpRequest.getJDiscRequest().creationTime(TimeUnit.MILLISECONDS);
if (queryProfile != null) {
// Move all request parameters to the query profile just to validate that the parameter settings are legal
- Properties queryProfileProperties = new QueryProfileProperties(queryProfile, encoder);
+ Properties queryProfileProperties = new QueryProfileProperties(queryProfile, embedder);
properties().chain(queryProfileProperties);
// TODO: Just checking legality rather than actually setting would be faster
setPropertiesFromRequestMap(requestMap, properties(), true); // Adds errors to the query for illegal set attempts
// Create the full chain
- properties().chain(new QueryProperties(this, queryProfile.getRegistry(), encoder)).
+ properties().chain(new QueryProperties(this, queryProfile.getRegistry(), embedder)).
chain(new ModelObjectMap()).
chain(new RequestContextProperties(requestMap)).
chain(queryProfileProperties).
@@ -378,7 +378,7 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
}
else { // bypass these complications if there is no query profile to get values from and validate against
properties().
- chain(new QueryProperties(this, CompiledQueryProfileRegistry.empty, encoder)).
+ chain(new QueryProperties(this, CompiledQueryProfileRegistry.empty, embedder)).
chain(new PropertyMap()).
chain(new DefaultProperties());
setPropertiesFromRequestMap(requestMap, properties(), false);
@@ -1130,7 +1130,7 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
private HttpRequest request = null;
private Map<String, String> requestMap = null;
private CompiledQueryProfile queryProfile = null;
- private Encoder encoder = Encoder.throwsOnUse;
+ private Embedder embedder = Embedder.throwsOnUse;
public Builder setRequest(String query) {
request = HttpRequest.createTestRequest(query, com.yahoo.jdisc.http.HttpRequest.Method.GET);
@@ -1168,12 +1168,12 @@ public class Query extends com.yahoo.processing.Request implements Cloneable {
/** Returns the query profile of this query, or null if none. */
public CompiledQueryProfile getQueryProfile() { return queryProfile; }
- public Builder setEncoder(Encoder encoder) {
- this.encoder = encoder;
+ public Builder setEmbedder(Embedder embedder) {
+ this.embedder = embedder;
return this;
}
- public Encoder getEncoder() { return encoder; }
+ public Embedder getEmbedder() { return embedder; }
/** Creates a new query from this builder. No properties are required to before calling this. */
public Query build() { return new Query(this); }
diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
index d1e57a30206..c15aef44f3d 100644
--- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
+++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java
@@ -23,7 +23,7 @@ import com.yahoo.io.IOUtils;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.Request;
import com.yahoo.language.Linguistics;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.net.HostName;
import com.yahoo.net.UriTools;
import com.yahoo.prelude.query.parser.ParseException;
@@ -106,7 +106,7 @@ public class SearchHandler extends LoggingRequestHandler {
private final String selfHostname = HostName.getLocalhost();
- private final Encoder encoder;
+ private final Embedder embedder;
private final ExecutionFactory executionFactory;
@@ -134,9 +134,9 @@ public class SearchHandler extends LoggingRequestHandler {
ContainerThreadPool threadpool,
CompiledQueryProfileRegistry queryProfileRegistry,
ContainerHttpConfig config,
- Encoder encoder,
+ Embedder embedder,
ExecutionFactory executionFactory) {
- this(statistics, metric, threadpool.executor(), queryProfileRegistry, encoder, executionFactory,
+ this(statistics, metric, threadpool.executor(), queryProfileRegistry, embedder, executionFactory,
config.numQueriesToTraceOnDebugAfterConstruction(),
config.hostResponseHeaderKey().equals("") ? Optional.empty() : Optional.of(config.hostResponseHeaderKey()));
}
@@ -170,7 +170,7 @@ public class SearchHandler extends LoggingRequestHandler {
metric,
executor,
queryProfileRegistry,
- Encoder.throwsOnUse,
+ Embedder.throwsOnUse,
executionFactory,
containerHttpConfig.numQueriesToTraceOnDebugAfterConstruction(),
containerHttpConfig.hostResponseHeaderKey().equals("") ?
@@ -192,7 +192,7 @@ public class SearchHandler extends LoggingRequestHandler {
metric,
executor,
QueryProfileConfigurer.createFromConfig(queryProfileConfig).compile(),
- Encoder.throwsOnUse,
+ Embedder.throwsOnUse,
executionFactory,
containerHttpConfig.numQueriesToTraceOnDebugAfterConstruction(),
containerHttpConfig.hostResponseHeaderKey().equals("") ?
@@ -210,7 +210,7 @@ public class SearchHandler extends LoggingRequestHandler {
CompiledQueryProfileRegistry queryProfileRegistry,
ExecutionFactory executionFactory,
Optional<String> hostResponseHeaderKey) {
- this(statistics, metric, executor, queryProfileRegistry, Encoder.throwsOnUse,
+ this(statistics, metric, executor, queryProfileRegistry, Embedder.throwsOnUse,
executionFactory, 0, hostResponseHeaderKey);
}
@@ -218,14 +218,14 @@ public class SearchHandler extends LoggingRequestHandler {
Metric metric,
Executor executor,
CompiledQueryProfileRegistry queryProfileRegistry,
- Encoder encoder,
+ Embedder embedder,
ExecutionFactory executionFactory,
long numQueriesToTraceOnDebugAfterStartup,
Optional<String> hostResponseHeaderKey) {
super(executor, metric, true);
log.log(Level.FINE, () -> "SearchHandler.init " + System.identityHashCode(this));
this.queryProfileRegistry = queryProfileRegistry;
- this.encoder = encoder;
+ this.embedder = embedder;
this.executionFactory = executionFactory;
this.maxThreads = examineExecutor(executor);
@@ -332,7 +332,7 @@ public class SearchHandler extends LoggingRequestHandler {
Query query = new Query.Builder().setRequest(request)
.setRequestMap(requestMap)
.setQueryProfile(queryProfile)
- .setEncoder(encoder)
+ .setEmbedder(embedder)
.build();
boolean benchmarking = VespaHeaders.benchmarkOutput(request);
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 e555000272d..53be827073c 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,7 +2,7 @@
package com.yahoo.search.query.profile;
import com.yahoo.collections.Pair;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.processing.IllegalInputException;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.processing.request.properties.PropertyMap;
@@ -30,7 +30,7 @@ import java.util.Map;
public class QueryProfileProperties extends Properties {
private final CompiledQueryProfile profile;
- private final Encoder encoder;
+ private final Embedder embedder;
// Note: The priority order is: values has precedence over references
@@ -45,14 +45,14 @@ public class QueryProfileProperties extends Properties {
private List<Pair<CompoundName, CompiledQueryProfile>> references = null;
public QueryProfileProperties(CompiledQueryProfile profile) {
- this(profile, Encoder.throwsOnUse);
+ this(profile, Embedder.throwsOnUse);
}
/** Creates an instance from a profile, throws an exception if the given profile is null */
- public QueryProfileProperties(CompiledQueryProfile profile, Encoder encoder) {
+ public QueryProfileProperties(CompiledQueryProfile profile, Embedder embedder) {
Validator.ensureNotNull("The profile wrapped by this cannot be null", profile);
this.profile = profile;
- this.encoder = encoder;
+ this.embedder = embedder;
}
/** Returns the query profile backing this, or null if none */
@@ -122,7 +122,7 @@ 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, new ConversionContext(profile.getRegistry(),
- encoder,
+ embedder,
context));
if (value == null)
throw new IllegalInputException("'" + value + "' is not a " +
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) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
index 02648f84066..3a426656185 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
@@ -1,7 +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.properties;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.processing.IllegalInputException;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
@@ -34,12 +34,12 @@ public class QueryProperties extends Properties {
private Query query;
private final CompiledQueryProfileRegistry profileRegistry;
- private final Encoder encoder;
+ private final Embedder embedder;
- public QueryProperties(Query query, CompiledQueryProfileRegistry profileRegistry, Encoder encoder) {
+ public QueryProperties(Query query, CompiledQueryProfileRegistry profileRegistry, Embedder embedder) {
this.query = query;
this.profileRegistry = profileRegistry;
- this.encoder = encoder;
+ this.embedder = embedder;
}
public void setParentQuery(Query query) {
@@ -380,7 +380,7 @@ public class QueryProperties extends Properties {
if (type == null) return value; // no type info -> keep as string
FieldDescription field = type.getField(key);
if (field == null) return value; // ditto
- return field.getType().convertFrom(value, new ConversionContext(profileRegistry, encoder, context));
+ return field.getType().convertFrom(value, new ConversionContext(profileRegistry, embedder, context));
}
private void throwIllegalParameter(String key,String namespace) {
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEncoderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java
index 3b48ae35fcf..18a9f11e15e 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEncoderTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java
@@ -8,7 +8,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Simon Thoresen Hult
*/
-public class IntegerEncoderTestCase {
+public class IntegerEmbedderTestCase {
@Test
public void requireThatIntEncoderWorksAsExpected() {
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
index 45f53a1cdb9..e22263070e0 100644
--- a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.search.query.profile.types.test;
import com.yahoo.component.ComponentId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.language.Language;
-import com.yahoo.language.process.Encoder;
+import com.yahoo.language.process.Embedder;
import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorType;
import com.yahoo.yolean.Exceptions;
@@ -22,7 +22,6 @@ import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry;
import org.junit.Before;
import org.junit.Test;
-import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -441,19 +440,19 @@ public class QueryProfileTypeTestCase {
}
@Test
- public void testUnencodedTensorRankFeatureInRequest() {
+ public void testUnembeddedTensorRankFeatureInRequest() {
QueryProfile profile = new QueryProfile("test");
profile.setType(testtype);
registry.register(profile);
CompiledQueryProfileRegistry cRegistry = registry.compile();
- String textToEncode = "text to encode as tensor";
+ String textToEmbed = "text to embed into a tensor";
Tensor expectedTensor = Tensor.from("tensor<float>(x[5]):[3,7,4,0,0]]");
Query query1 = new Query.Builder().setRequest(HttpRequest.createTestRequest("?" + urlEncode("ranking.features.query(myTensor4)") +
- "=" + urlEncode("encode(" + textToEncode + ")"),
+ "=" + urlEncode("embed(" + textToEmbed + ")"),
com.yahoo.jdisc.http.HttpRequest.Method.GET))
.setQueryProfile(cRegistry.getComponent("test"))
- .setEncoder(new MockEncoder(textToEncode, Language.UNKNOWN, expectedTensor))
+ .setEmbedder(new MockEmbedder(textToEmbed, Language.UNKNOWN, expectedTensor))
.build();
assertEquals(0, query1.errors().size());
assertEquals(expectedTensor, query1.properties().get("ranking.features.query(myTensor4)"));
@@ -461,11 +460,11 @@ public class QueryProfileTypeTestCase {
// Explicit language
Query query2 = new Query.Builder().setRequest(HttpRequest.createTestRequest("?" + urlEncode("ranking.features.query(myTensor4)") +
- "=" + urlEncode("encode(" + textToEncode + ")") +
+ "=" + urlEncode("embed(" + textToEmbed + ")") +
"&language=en",
com.yahoo.jdisc.http.HttpRequest.Method.GET))
.setQueryProfile(cRegistry.getComponent("test"))
- .setEncoder(new MockEncoder(textToEncode, Language.ENGLISH, expectedTensor))
+ .setEmbedder(new MockEmbedder(textToEmbed, Language.ENGLISH, expectedTensor))
.build();
assertEquals(0, query2.errors().size());
assertEquals(expectedTensor, query2.properties().get("ranking.features.query(myTensor4)"));
@@ -723,28 +722,28 @@ public class QueryProfileTypeTestCase {
}
}
- private static final class MockEncoder implements Encoder {
+ private static final class MockEmbedder implements Embedder {
private final String expectedText;
private final Language expectedLanguage;
private final Tensor tensorToReturn;
- public MockEncoder(String expectedText,
- Language expectedLanguage,
- Tensor tensorToReturn) {
+ public MockEmbedder(String expectedText,
+ Language expectedLanguage,
+ Tensor tensorToReturn) {
this.expectedText = expectedText;
this.expectedLanguage = expectedLanguage;
this.tensorToReturn = tensorToReturn;
}
@Override
- public List<Integer> encode(String text, Language language) {
+ public List<Integer> embed(String text, Language language) {
fail("Unexpected call");
return null;
}
@Override
- public Tensor encode(String text, Language language, TensorType tensorType) {
+ public Tensor embed(String text, Language language, TensorType tensorType) {
assertEquals(expectedText, text);
assertEquals(expectedLanguage, language);
assertEquals(tensorToReturn.type(), tensorType);