aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@vespa.ai>2024-02-21 14:31:27 +0000
committerArne Juul <arnej@vespa.ai>2024-02-22 10:36:19 +0000
commit97eff1f15dcafe4a8d0229fa36b3e0448de2f4d6 (patch)
tree7bfa620f51263b3e2c6cc1bd319b922a0cb33a09
parent4f0947b6617f5c9ff0a133a1f12bb4a5b7d57bb6 (diff)
allow inputs { query(foo) string }
-rw-r--r--config-model/src/main/java/com/yahoo/schema/RankProfile.java16
-rw-r--r--config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java4
-rw-r--r--config-model/src/main/javacc/SchemaParser.jj25
-rw-r--r--config-model/src/test/derived/rankingexpression/rank-profiles.cfg11
-rw-r--r--config-model/src/test/derived/rankingexpression/rankexpression.sd13
-rw-r--r--config-model/src/test/derived/rankingexpression/summary.cfg9
-rw-r--r--container-search/abi-spec.json23
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java23
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/RankProfile.java23
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java7
-rw-r--r--container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java15
-rw-r--r--container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java17
13 files changed, 134 insertions, 54 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfile.java b/config-model/src/main/java/com/yahoo/schema/RankProfile.java
index 9b3e236612a..22bf1880cd7 100644
--- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java
@@ -17,6 +17,7 @@ import com.yahoo.schema.expressiontransforms.ExpressionTransforms;
import com.yahoo.schema.expressiontransforms.RankProfileTransformContext;
import com.yahoo.schema.expressiontransforms.InputRecorder;
import com.yahoo.schema.parser.ParseException;
+import com.yahoo.search.schema.RankProfile.InputType;
import com.yahoo.searchlib.rankingexpression.ExpressionFunction;
import com.yahoo.searchlib.rankingexpression.FeatureList;
import com.yahoo.searchlib.rankingexpression.RankingExpression;
@@ -841,7 +842,7 @@ public class RankProfile implements Cloneable {
if (inputs.containsKey(reference)) {
Input existing = inputs().get(reference);
if (! input.equals(existing))
- throw new IllegalArgumentException("Duplicate input: Has both " + input + " and existing");
+ throw new IllegalArgumentException("Duplicate input: Has both " + input + " and existing " + existing);
}
inputs.put(reference, input);
}
@@ -1177,7 +1178,8 @@ public class RankProfile implements Cloneable {
private Map<Reference, TensorType> featureTypes() {
Map<Reference, TensorType> featureTypes = inputs().values().stream()
- .collect(Collectors.toMap(input -> input.name(), input -> input.type()));
+ .collect(Collectors.toMap(input -> input.name(),
+ input -> input.type().tensorType()));
allFields().forEach(field -> addAttributeFeatureTypes(field, featureTypes));
allImportedFields().forEach(field -> addAttributeFeatureTypes(field, featureTypes));
return featureTypes;
@@ -1545,17 +1547,21 @@ public class RankProfile implements Cloneable {
public static final class Input {
private final Reference name;
- private final TensorType type;
+ private final InputType type;
private final Optional<Tensor> defaultValue;
- public Input(Reference name, TensorType type, Optional<Tensor> defaultValue) {
+ public Input(Reference name, InputType type, Optional<Tensor> defaultValue) {
this.name = name;
this.type = type;
this.defaultValue = defaultValue;
}
+ public Input(Reference name, TensorType tType, Optional<Tensor> defaultValue) {
+ this(name, new InputType(tType, false), defaultValue);
+ }
+
public Reference name() { return name; }
- public TensorType type() { return type; }
+ public InputType type() { return type; }
public Optional<Tensor> defaultValue() { return defaultValue; }
@Override
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java b/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
index 33a363312d6..db76d6397fc 100644
--- a/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
+++ b/config-model/src/main/java/com/yahoo/schema/derived/RawRankProfile.java
@@ -519,12 +519,12 @@ public class RawRankProfile implements RankProfilesConfig.Producer {
for (var input : inputs.values()) {
if (FeatureNames.isQueryFeature(input.name())) {
- if (input.type().rank() > 0) // Proton does not like representing the double type as a rank 0 tensor
+ if (input.type().tensorType().rank() > 0) // Proton does not like representing the double type as a rank 0 tensor
properties.add(new Pair<>("vespa.type.query." + input.name().arguments().expressions().get(0),
input.type().toString()));
if (input.defaultValue().isPresent()) {
properties.add(new Pair<>(input.name().toString(),
- input.type().rank() == 0 ?
+ input.type().tensorType().rank() == 0 ?
String.valueOf(input.defaultValue().get().asDouble()) :
input.defaultValue().get().toString(true, false)));
}
diff --git a/config-model/src/main/javacc/SchemaParser.jj b/config-model/src/main/javacc/SchemaParser.jj
index f298293ed57..d769f6208aa 100644
--- a/config-model/src/main/javacc/SchemaParser.jj
+++ b/config-model/src/main/javacc/SchemaParser.jj
@@ -34,6 +34,7 @@ import com.yahoo.schema.document.Stemming;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.FeatureNames;
import com.yahoo.schema.fieldoperation.IndexingOperation;
+import com.yahoo.search.schema.RankProfile.InputType;
import com.yahoo.searchlib.rankingexpression.FeatureList;
import com.yahoo.searchlib.rankingexpression.Reference;
import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue;
@@ -298,6 +299,7 @@ TOKEN :
| < HNSW: "hnsw" >
| < MAX_LINKS_PER_NODE: "max-links-per-node" >
| < DOUBLE_KEYWORD: "double" >
+| < STRING_KEYWORD: "string" >
| < DISTANCE_METRIC: "distance-metric" >
| < NEIGHBORS_TO_EXPLORE_AT_INSERT: "neighbors-to-explore-at-insert" >
| < MULTI_THREADED_INDEXING: "multi-threaded-indexing" >
@@ -2012,11 +2014,11 @@ void inputs(ParsedRankProfile profile) :
void input(ParsedRankProfile profile) :
{
Reference reference;
- TensorType type = TensorType.empty;
+ InputType type = new InputType(TensorType.empty, false);
Tensor defaultValue = null;
}
{
- reference = inputName() ( type = valueType(reference))? ( <COLON> (<NL>)* defaultValue = tensorValue(type) )?
+ reference = inputName() ( type = valueType(reference))? ( <COLON> (<NL>)* defaultValue = tensorValue(type.tensorType()) )?
{ profile.addInput(reference, new RankProfile.Input(reference, type, Optional.ofNullable(defaultValue))); }
}
@@ -2034,18 +2036,20 @@ Reference inputName() :
{ return FeatureNames.asQueryFeature(name); }
}
-TensorType valueType(Reference reference) :
+InputType valueType(Reference reference) :
{
TensorType type;
-
+ InputType result;
}
{
(
- ( type = tensorType("Type of " + reference) )
+ ( type = tensorType("Type of " + reference) { result = new InputType(type, false); } )
+ |
+ ( <DOUBLE_KEYWORD> { result = new InputType(TensorType.empty, false); } )
|
- ( <DOUBLE_KEYWORD> { type = TensorType.empty; } )
+ ( <STRING_KEYWORD> { result = new InputType(TensorType.empty, true); } )
)
- { return type; }
+ { return result; }
}
/**
@@ -2329,7 +2333,7 @@ void constants(ParsedSchema schema, ParsedRankProfile profile) :
void constant(ParsedSchema schema, ParsedRankProfile profile) :
{
Reference name = null;
- TensorType type = TensorType.empty;
+ InputType type = new InputType(TensorType.empty, false);
Tensor value = null;
String valuePath = null;
}
@@ -2337,12 +2341,12 @@ void constant(ParsedSchema schema, ParsedRankProfile profile) :
(
name = constantName()
(
- LOOKAHEAD(4) ( ( type = valueType(name) )? <COLON> (<NL>)* ( value = tensorValue(type) | valuePath = fileItem())
+ LOOKAHEAD(4) ( ( type = valueType(name) )? <COLON> (<NL>)* ( value = tensorValue(type.tensorType()) | valuePath = fileItem())
{
if (value != null)
profile.add(new RankProfile.Constant(name, value));
else
- profile.add(new RankProfile.Constant(name, type, valuePath));
+ profile.add(new RankProfile.Constant(name, type.tensorType(), valuePath));
}
)
| // Deprecated forms (TODO: Vespa > 8: Add warning):
@@ -2710,6 +2714,7 @@ String identifier() : { }
| <DIVERSITY>
| <DOCUMENT>
| <DOUBLE_KEYWORD>
+ | <STRING_KEYWORD>
| <DYNAMIC>
| <EXACT>
| <FALSE>
diff --git a/config-model/src/test/derived/rankingexpression/rank-profiles.cfg b/config-model/src/test/derived/rankingexpression/rank-profiles.cfg
index 87882eef273..8b769360053 100644
--- a/config-model/src/test/derived/rankingexpression/rank-profiles.cfg
+++ b/config-model/src/test/derived/rankingexpression/rank-profiles.cfg
@@ -670,3 +670,14 @@ rankprofile[].fef.property[].name "vespa.feature.rename"
rankprofile[].fef.property[].value "useAttr(t1,42)"
rankprofile[].fef.property[].name "vespa.type.attribute.t1"
rankprofile[].fef.property[].value "tensor(m{},v[3])"
+rankprofile[].name "withstringcompare"
+rankprofile[].fef.property[].name "vespa.rank.firstphase"
+rankprofile[].fef.property[].value "rankingExpression(firstphase)"
+rankprofile[].fef.property[].name "rankingExpression(firstphase).rankingScript"
+rankprofile[].fef.property[].value "if (attribute(surl) == query(myquerystring), 0.75, 0.25)"
+rankprofile[].fef.property[].name "vespa.rank.secondphase"
+rankprofile[].fef.property[].value "rankingExpression(secondphase)"
+rankprofile[].fef.property[].name "rankingExpression(secondphase).rankingScript"
+rankprofile[].fef.property[].value "if (attribute(surl) == query(undeclaredinput), 0.75, 0.25)"
+rankprofile[].fef.property[].name "vespa.type.attribute.t1"
+rankprofile[].fef.property[].value "tensor(m{},v[3])"
diff --git a/config-model/src/test/derived/rankingexpression/rankexpression.sd b/config-model/src/test/derived/rankingexpression/rankexpression.sd
index 1ccf74bfe17..76672906252 100644
--- a/config-model/src/test/derived/rankingexpression/rankexpression.sd
+++ b/config-model/src/test/derived/rankingexpression/rankexpression.sd
@@ -20,7 +20,7 @@ schema rankexpression {
}
field surl type string {
- indexing: summary
+ indexing: summary | attribute
}
field year type int {
@@ -507,4 +507,15 @@ schema rankexpression {
}
}
+ rank-profile withstringcompare {
+ inputs {
+ query(myquerystring) string
+ }
+ first-phase {
+ expression: if (attribute(surl) == query(myquerystring), 0.75, 0.25)
+ }
+ second-phase {
+ expression: if (attribute(surl) == query(undeclaredinput), 0.75, 0.25)
+ }
+ }
}
diff --git a/config-model/src/test/derived/rankingexpression/summary.cfg b/config-model/src/test/derived/rankingexpression/summary.cfg
index b52cb055164..9f96f5ab4a7 100644
--- a/config-model/src/test/derived/rankingexpression/summary.cfg
+++ b/config-model/src/test/derived/rankingexpression/summary.cfg
@@ -10,8 +10,8 @@ classes[].fields[].name "title"
classes[].fields[].command ""
classes[].fields[].source ""
classes[].fields[].name "surl"
-classes[].fields[].command ""
-classes[].fields[].source ""
+classes[].fields[].command "attribute"
+classes[].fields[].source "surl"
classes[].fields[].name "year"
classes[].fields[].command "attribute"
classes[].fields[].source "year"
@@ -24,7 +24,7 @@ classes[].fields[].source ""
classes[].fields[].name "documentid"
classes[].fields[].command "documentid"
classes[].fields[].source ""
-classes[].id 399614584
+classes[].id 799304810
classes[].name "attributeprefetch"
classes[].omitsummaryfeatures false
classes[].fields[].name "nrtgmp"
@@ -33,6 +33,9 @@ classes[].fields[].source "nrtgmp"
classes[].fields[].name "glmpfw"
classes[].fields[].command "attribute"
classes[].fields[].source "glmpfw"
+classes[].fields[].name "surl"
+classes[].fields[].command "attribute"
+classes[].fields[].source "surl"
classes[].fields[].name "year"
classes[].fields[].command "attribute"
classes[].fields[].source "year"
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json
index cedc11375c8..73376ac4b25 100644
--- a/container-search/abi-spec.json
+++ b/container-search/abi-spec.json
@@ -8452,11 +8452,30 @@
"public void <init>(java.lang.String)",
"public com.yahoo.search.schema.RankProfile$Builder setHasSummaryFeatures(boolean)",
"public com.yahoo.search.schema.RankProfile$Builder setHasRankFeatures(boolean)",
- "public com.yahoo.search.schema.RankProfile$Builder addInput(java.lang.String, com.yahoo.tensor.TensorType)",
+ "public com.yahoo.search.schema.RankProfile$Builder addInput(java.lang.String, com.yahoo.search.schema.RankProfile$InputType)",
"public com.yahoo.search.schema.RankProfile build()"
],
"fields" : [ ]
},
+ "com.yahoo.search.schema.RankProfile$InputType" : {
+ "superClass" : "java.lang.Record",
+ "interfaces" : [ ],
+ "attributes" : [
+ "public",
+ "final",
+ "record"
+ ],
+ "methods" : [
+ "public void <init>(com.yahoo.tensor.TensorType, boolean)",
+ "public java.lang.String toString()",
+ "public static com.yahoo.search.schema.RankProfile$InputType fromSpec(java.lang.String)",
+ "public final int hashCode()",
+ "public final boolean equals(java.lang.Object)",
+ "public com.yahoo.tensor.TensorType tensorType()",
+ "public boolean declaredString()"
+ ],
+ "fields" : [ ]
+ },
"com.yahoo.search.schema.RankProfile" : {
"superClass" : "java.lang.Object",
"interfaces" : [ ],
@@ -8519,7 +8538,7 @@
"public boolean isStreaming()",
"public java.util.Collection schemas()",
"public java.util.Optional fieldInfo(java.lang.String)",
- "public com.yahoo.tensor.TensorType rankProfileInput(java.lang.String, java.lang.String)"
+ "public com.yahoo.search.schema.RankProfile$InputType rankProfileInput(java.lang.String, java.lang.String)"
],
"fields" : [ ]
},
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
index 82e1409c4eb..ea2120dae3f 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
@@ -6,6 +6,8 @@ import com.yahoo.language.process.Embedder;
import com.yahoo.processing.IllegalInputException;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
+import com.yahoo.search.schema.RankProfile;
+import com.yahoo.search.schema.RankProfile.InputType;
import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.schema.internal.TensorConverter;
import com.yahoo.search.query.Properties;
@@ -39,9 +41,16 @@ public class RankProfileInputProperties extends Properties {
public void set(CompoundName name, Object value, Map<String, String> context) {
if (RankFeatures.isFeatureName(name.toString())) {
try {
- TensorType expectedType = typeOf(name);
- if (expectedType != null) {
- value = tensorConverter.convertTo(expectedType,
+ var expectedType = typeOf(name);
+ System.err.println("setting rank feature '" + name + "' -> " + value + " :: " + value.getClass());
+ if (expectedType != null && expectedType.declaredString()) {
+ System.err.println("expected type: declared string");
+ var e = new IllegalArgumentException("foo");
+ e.fillInStackTrace();
+ e.printStackTrace();
+ }
+ if (expectedType != null && ! expectedType.declaredString()) {
+ value = tensorConverter.convertTo(expectedType.tensorType(),
name.last(),
value,
query.getModel().getLanguage(),
@@ -59,14 +68,14 @@ public class RankProfileInputProperties extends Properties {
@Override
public void requireSettable(CompoundName name, Object value, Map<String, String> context) {
if (RankFeatures.isFeatureName(name.toString())) {
- TensorType expectedType = typeOf(name);
- if (expectedType != null)
- verifyType(name, value, expectedType);
+ var expectedType = typeOf(name);
+ if (expectedType != null && ! expectedType.declaredString())
+ verifyType(name, value, expectedType.tensorType());
}
super.requireSettable(name, value, context);
}
- private TensorType typeOf(CompoundName name) {
+ private RankProfile.InputType typeOf(CompoundName name) {
// Session is lazily resolved because order matters:
// model.sources+restrict must be set in the query before this is done
if (session == null)
diff --git a/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java b/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
index d681062451c..a5b8d328a7a 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/RankProfile.java
@@ -18,10 +18,25 @@ import java.util.Objects;
@Beta
public class RankProfile {
+ public record InputType(TensorType tensorType, boolean declaredString) {
+ public String toString() {
+ return declaredString ? "string" : tensorType.toString();
+ }
+ public static InputType fromSpec(String spec) {
+ if ("string".equals(spec)) {
+ return new InputType(TensorType.empty, true);
+ }
+ if ("double".equals(spec)) {
+ return new InputType(TensorType.empty, false);
+ }
+ return new InputType(TensorType.fromSpec(spec), false);
+ }
+ }
+
private final String name;
private final boolean hasSummaryFeatures;
private final boolean hasRankFeatures;
- private final Map<String, TensorType> inputs;
+ private final Map<String, InputType> inputs;
// Assigned when this is added to a schema
private Schema schema = null;
@@ -52,7 +67,7 @@ public class RankProfile {
public boolean hasRankFeatures() { return hasRankFeatures; }
/** Returns the inputs explicitly declared in this rank profile. */
- public Map<String, TensorType> inputs() { return inputs; }
+ public Map<String, InputType> inputs() { return inputs; }
@Override
public boolean equals(Object o) {
@@ -80,7 +95,7 @@ public class RankProfile {
private final String name;
private boolean hasSummaryFeatures = true;
private boolean hasRankFeatures = true;
- private final Map<String, TensorType> inputs = new LinkedHashMap<>();
+ private final Map<String, InputType> inputs = new LinkedHashMap<>();
public Builder(String name) {
this.name = Objects.requireNonNull(name);
@@ -96,7 +111,7 @@ public class RankProfile {
return this;
}
- public Builder addInput(String name, TensorType type) {
+ public Builder addInput(String name, InputType type) {
inputs.put(name, type);
return this;
}
diff --git a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
index 263fa4058c7..df7a5cab3c1 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfo.java
@@ -6,7 +6,6 @@ import com.yahoo.component.annotation.Inject;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.search.Query;
import com.yahoo.search.config.SchemaInfoConfig;
-import com.yahoo.tensor.TensorType;
import java.util.Collection;
import java.util.Collections;
@@ -184,16 +183,16 @@ public class SchemaInfo {
* feature is declared in this rank profile in multiple schemas
* of this session with conflicting types
*/
- public TensorType rankProfileInput(String rankFeature, String rankProfile) {
+ public RankProfile.InputType rankProfileInput(String rankFeature, String rankProfile) {
if (schemas.isEmpty()) return null; // no matching schemas - validated elsewhere
List<RankProfile> profiles = profilesNamed(rankProfile);
if (profiles.isEmpty())
throw new IllegalArgumentException("No profile named '" + rankProfile + "' exists in schemas [" +
schemas.stream().map(Schema::name).collect(Collectors.joining(", ")) + "]");
- TensorType foundType = null;
+ RankProfile.InputType foundType = null;
RankProfile declaringProfile = null;
for (RankProfile profile : profiles) {
- TensorType newlyFoundType = profile.inputs().get(rankFeature);
+ RankProfile.InputType newlyFoundType = profile.inputs().get(rankFeature);
if (newlyFoundType == null) continue;
if (foundType != null && ! newlyFoundType.equals(foundType))
throw new IllegalArgumentException("Conflicting input type declarations for '" + rankFeature + "': " +
diff --git a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
index b70f5145e56..b576260b85d 100644
--- a/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
+++ b/container-search/src/main/java/com/yahoo/search/schema/SchemaInfoConfigurer.java
@@ -27,7 +27,7 @@ class SchemaInfoConfigurer {
profileBuilder.setHasSummaryFeatures(profileConfig.hasSummaryFeatures());
profileBuilder.setHasRankFeatures(profileConfig.hasRankFeatures());
for (var inputConfig : profileConfig.input())
- profileBuilder.addInput(inputConfig.name(), TensorType.fromSpec(inputConfig.type()));
+ profileBuilder.addInput(inputConfig.name(), RankProfile.InputType.fromSpec(inputConfig.type()));
builder.add(profileBuilder.build());
}
diff --git a/container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java b/container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java
index 2feac135b03..3cdfc95ea0e 100644
--- a/container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java
+++ b/container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java
@@ -7,6 +7,7 @@ import com.yahoo.language.process.Embedder;
import com.yahoo.search.Query;
import com.yahoo.search.schema.Cluster;
import com.yahoo.search.schema.RankProfile;
+import com.yahoo.search.schema.RankProfile.InputType;
import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.query.profile.QueryProfile;
@@ -298,23 +299,23 @@ public class RankProfileInputTest {
private SchemaInfo createSchemaInfo() {
List<Schema> schemas = new ArrayList<>();
RankProfile.Builder common = new RankProfile.Builder("commonProfile")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
- .addInput("query(myTensor2)", TensorType.fromSpec("tensor(x[2],y[2])"))
- .addInput("query(myTensor3)", TensorType.fromSpec("tensor(x[2],y[2])"))
- .addInput("query(myTensor4)", TensorType.fromSpec("tensor<float>(x[5])"));
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor2)", InputType.fromSpec("tensor(x[2],y[2])"))
+ .addInput("query(myTensor3)", InputType.fromSpec("tensor(x[2],y[2])"))
+ .addInput("query(myTensor4)", InputType.fromSpec("tensor<float>(x[5])"));
schemas.add(new Schema.Builder("a")
.add(common.build())
.add(new RankProfile.Builder("inconsistent")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
.build())
.build());
schemas.add(new Schema.Builder("b")
.add(common.build())
.add(new RankProfile.Builder("inconsistent")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(x[10])"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(x[10])"))
.build())
.add(new RankProfile.Builder("bOnly")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
.build())
.build());
List<Cluster> clusters = new ArrayList<>();
diff --git a/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java b/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
index c27fe9ff15d..553f71d91b2 100644
--- a/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
+++ b/container-search/src/test/java/com/yahoo/search/schema/SchemaInfoTester.java
@@ -6,6 +6,7 @@ import com.yahoo.search.Query;
import com.yahoo.search.config.IndexInfoConfig;
import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.search.schema.RankProfile;
+import com.yahoo.search.schema.RankProfile.InputType;
import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.tensor.TensorType;
@@ -43,7 +44,7 @@ public class SchemaInfoTester {
void assertInput(TensorType expectedType, String sources, String restrict, String rankProfile, String feature) {
assertEquals(expectedType,
- schemaInfo.newSession(query(sources, restrict)).rankProfileInput(feature, rankProfile));
+ schemaInfo.newSession(query(sources, restrict)).rankProfileInput(feature, rankProfile).tensorType());
}
void assertInputConflict(TensorType expectedType, String sources, String restrict, String rankProfile, String feature) {
@@ -59,14 +60,14 @@ public class SchemaInfoTester {
static SchemaInfo createSchemaInfo() {
List<Schema> schemas = new ArrayList<>();
RankProfile.Builder common = new RankProfile.Builder("commonProfile")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
- .addInput("query(myTensor2)", TensorType.fromSpec("tensor(x[2],y[2])"))
- .addInput("query(myTensor3)", TensorType.fromSpec("tensor(x[2],y[2])"))
- .addInput("query(myTensor4)", TensorType.fromSpec("tensor<float>(x[5])"));
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor2)", InputType.fromSpec("tensor(x[2],y[2])"))
+ .addInput("query(myTensor3)", InputType.fromSpec("tensor(x[2],y[2])"))
+ .addInput("query(myTensor4)", InputType.fromSpec("tensor<float>(x[5])"));
schemas.add(new Schema.Builder("a")
.add(common.build())
.add(new RankProfile.Builder("inconsistent")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
.build())
.add(new DocumentSummary.Builder("testSummary")
.add(new DocumentSummary.Field("field1", "string"))
@@ -77,10 +78,10 @@ public class SchemaInfoTester {
schemas.add(new Schema.Builder("b")
.add(common.build())
.add(new RankProfile.Builder("inconsistent")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(x[10])"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(x[10])"))
.build())
.add(new RankProfile.Builder("bOnly")
- .addInput("query(myTensor1)", TensorType.fromSpec("tensor(a{},b{})"))
+ .addInput("query(myTensor1)", InputType.fromSpec("tensor(a{},b{})"))
.build())
.build());
List<Cluster> clusters = new ArrayList<>();