From 4f2994d9301034e943620e106540fa80a6c3f01e Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Thu, 21 Apr 2022 15:56:41 +0200 Subject: Resolve rank profile inputs --- .../src/main/java/com/yahoo/search/query/Ranking.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'container-search/src/main/java/com/yahoo/search/query/Ranking.java') 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 lookupRankProfileIn(Map 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()); -- cgit v1.2.3