diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/properties')
3 files changed, 37 insertions, 15 deletions
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 d49a6b13b54..cf9209dcc0d 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 @@ -36,6 +36,7 @@ public class QueryProperties extends Properties { private final CompiledQueryProfileRegistry profileRegistry; private final Map<String, Embedder> embedders; + @Deprecated // TODO: Remove on Vespa 8 public QueryProperties(Query query, CompiledQueryProfileRegistry profileRegistry, Embedder embedder) { this(query, profileRegistry, Map.of(Embedder.defaultEmbedderId, embedder)); } @@ -322,20 +323,6 @@ public class QueryProperties extends Properties { throwIllegalParameter(key.last(), Select.SELECT); } } - else if (key.first().equals("rankfeature") || key.first().equals("featureoverride") ) { // featureoverride is deprecated - chained().requireSettable(key, value, context); - setRankFeature(query, key.rest().toString(), toSpecifiedType(key.rest().toString(), - value, - profileRegistry.getTypeRegistry().getComponent("features"), - context)); - } - else if (key.first().equals("rankproperty")) { - chained().requireSettable(key, value, context); - query.getRanking().getProperties().put(key.rest().toString(), toSpecifiedType(key.rest().toString(), - value, - profileRegistry.getTypeRegistry().getComponent("properties"), - context)); - } else if (key.size() == 1) { if (key.equals(Query.HITS)) query.setHits(asInteger(value,10)); diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryPropertyAliases.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryPropertyAliases.java index 14f06bce6e6..e46668ffb83 100644 --- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryPropertyAliases.java +++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryPropertyAliases.java @@ -23,7 +23,8 @@ public class QueryPropertyAliases extends PropertyAliases { @Override protected CompoundName unalias(CompoundName nameOrAlias) { - if (nameOrAlias.first().equalsIgnoreCase("rankfeature")) + if (nameOrAlias.first().equalsIgnoreCase("rankfeature") + || nameOrAlias.first().equalsIgnoreCase("featureoverride")) // deprecated: TODO Remove on Vespa 8 return nameOrAlias.rest().prepend("ranking", "features"); else if (nameOrAlias.first().equalsIgnoreCase("rankproperty")) return nameOrAlias.rest().prepend("ranking", "properties"); 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 new file mode 100644 index 00000000000..6769f05bb3e --- /dev/null +++ b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java @@ -0,0 +1,34 @@ +// Copyright Yahoo. 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.api.annotations.Beta; +import com.yahoo.processing.request.CompoundName; +import com.yahoo.search.Query; +import com.yahoo.search.query.Properties; + +import java.util.Map; + +/** + * Verifies and converts properties according to any input declarations in the rank profile set on the query. + * + * @author bratseth + */ +@Beta +public class RankProfileInputProperties extends Properties { + + private final Query query; + + public RankProfileInputProperties(Query query) { + this.query = query; + } + + /** + * Throws IllegalInputException if the given key cannot be set to the given value. + * This default implementation just passes to the chained properties, if any. + */ + public void requireSettable(CompoundName name, Object value, Map<String, String> context) { + if (chained() != null) + chained().requireSettable(name, value, context); + } + +} |