summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/Ranking.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-04-21 15:56:41 +0200
committerJon Bratseth <bratseth@gmail.com>2022-04-21 15:56:41 +0200
commit4f2994d9301034e943620e106540fa80a6c3f01e (patch)
tree6b0a76afd976bbd314f1ba5c3764af12f88ef724 /container-search/src/main/java/com/yahoo/search/query/Ranking.java
parent50c7dfee0a9f32debb34d06191808cbd6ae67e4c (diff)
Resolve rank profile inputs
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/Ranking.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Ranking.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/Ranking.java b/container-search/src/main/java/com/yahoo/search/query/Ranking.java
index 94b8b5f63f1..fd0cd5a85b7 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Ranking.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Ranking.java
@@ -52,18 +52,14 @@ public class Ranking implements Cloneable {
public static final String FEATURES = "features";
public static final String PROPERTIES = "properties";
- /** For internal use only. */
- public static Optional<String> lookupRankProfileIn(Map<String, String> properties) {
- return Optional.ofNullable(Optional.ofNullable(properties.get(RANKING + "." + PROFILE))
- .orElse(properties.get("ranking")));
- }
-
static {
argumentType = new QueryProfileType(RANKING);
argumentType.setStrict(true);
argumentType.setBuiltin(true);
+ // Note: Order here matters as fields are set in this order, and rank feature conversion depends
+ // on other fields already being set (see RankProfileInputProperties)
+ argumentType.addField(new FieldDescription(PROFILE, "string", "ranking"));
argumentType.addField(new FieldDescription(LOCATION, "string", "location"));
- argumentType.addField(new FieldDescription(PROFILE, "string", "ranking")); // Alias repeated in lookupRankProfileIn
argumentType.addField(new FieldDescription(SORTING, "string", "sorting sortspec"));
argumentType.addField(new FieldDescription(LIST_FEATURES, "string", RANKFEATURES.toString()));
argumentType.addField(new FieldDescription(FRESHNESS, "string", "datetime"));
@@ -73,7 +69,7 @@ public class Ranking implements Cloneable {
argumentType.addField(new FieldDescription(DIVERSITY, new QueryProfileFieldType(Diversity.getArgumentType())));
argumentType.addField(new FieldDescription(SOFTTIMEOUT, new QueryProfileFieldType(SoftTimeout.getArgumentType())));
argumentType.addField(new FieldDescription(MATCHING, new QueryProfileFieldType(Matching.getArgumentType())));
- argumentType.addField(new FieldDescription(FEATURES, "query-profile", "rankfeature"));
+ argumentType.addField(new FieldDescription(FEATURES, "query-profile", "rankfeature")); // Repeated at the end of RankFeatures
argumentType.addField(new FieldDescription(PROPERTIES, "query-profile", "rankproperty"));
argumentType.freeze();
argumentTypeName = new CompoundName(argumentType.getId().getName());