diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-02-04 07:41:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-04 07:41:31 +0100 |
commit | 72cd1c70fdbe01968ef5a6ed6e05f5fa0ba4d319 (patch) | |
tree | 1552b25d1eb0233bfb1cdc8c36adf8190302af52 /container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java | |
parent | 17e572d4dad3c9e5040544072dbdc9f7a703e7bd (diff) |
Revert "Bratseth/anonymous query profile types take 2"
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java | 24 |
1 files changed, 7 insertions, 17 deletions
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 05e3c4fe9a0..5d4f39cecbf 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 @@ -9,7 +9,6 @@ import com.yahoo.search.query.Properties; import com.yahoo.search.query.profile.compiled.CompiledQueryProfile; import com.yahoo.search.query.profile.compiled.DimensionalValue; import com.yahoo.search.query.profile.types.FieldDescription; -import com.yahoo.search.query.profile.types.QueryProfileFieldType; import com.yahoo.search.query.profile.types.QueryProfileType; import java.util.ArrayList; @@ -88,10 +87,8 @@ public class QueryProfileProperties extends Properties { // Check types if ( ! profile.getTypes().isEmpty()) { - QueryProfileType type = null; - for (int i = 0; i < name.size(); i++) { - if (type == null) // We're on the first iteration, or no type is explicitly specified - type = profile.getType(name.first(i), context); + for (int i = 0; i<name.size(); i++) { + QueryProfileType type = profile.getType(name.first(i), context); if (type == null) continue; String localName = name.get(i); FieldDescription fieldDescription = type.getField(localName); @@ -100,19 +97,12 @@ public class QueryProfileProperties extends Properties { // TODO: In addition to strictness, check legality along the way - if (fieldDescription != null) { - if (i == name.size() - 1) { // at the end of the path, check the assignment type - value = fieldDescription.getType().convertFrom(value, profile.getRegistry()); - if (value == null) - throw new IllegalArgumentException("'" + value + "' is not a " + - fieldDescription.getType().toInstanceDescription()); - } - else if (fieldDescription.getType() instanceof QueryProfileFieldType) { - // If a type is specified, use that instead of the type implied by the name - type = ((QueryProfileFieldType) fieldDescription.getType()).getQueryProfileType(); - } + if (i == name.size()-1 && fieldDescription != null) { // at the end of the path, check the assignment type + value = fieldDescription.getType().convertFrom(value, profile.getRegistry()); + if (value == null) + throw new IllegalArgumentException("'" + value + "' is not a " + + fieldDescription.getType().toInstanceDescription()); } - } } |