aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/javacc
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-13 12:14:09 +0200
committerGitHub <noreply@github.com>2022-05-13 12:14:09 +0200
commit64b4e9c4236bbf924230dcc4750094da30496b63 (patch)
tree810f8b8d2d070ac7e21704ea00ae3b20b62e5f2c /config-model/src/main/javacc
parent1df3b3c59251bd4fd1b099ae5cfb4c280313e76d (diff)
Revert "Bratseth/constants cleanup take 2"
Diffstat (limited to 'config-model/src/main/javacc')
-rw-r--r--config-model/src/main/javacc/IntermediateParser.jj14
1 files changed, 7 insertions, 7 deletions
diff --git a/config-model/src/main/javacc/IntermediateParser.jj b/config-model/src/main/javacc/IntermediateParser.jj
index 873196d8bda..1fabe9c57c4 100644
--- a/config-model/src/main/javacc/IntermediateParser.jj
+++ b/config-model/src/main/javacc/IntermediateParser.jj
@@ -24,6 +24,7 @@ import com.yahoo.searchdefinition.OnnxModel;
import com.yahoo.searchdefinition.RankProfile.DiversitySettings;
import com.yahoo.searchdefinition.RankProfile.MatchPhaseSettings;
import com.yahoo.searchdefinition.RankProfile;
+import com.yahoo.searchdefinition.RankingConstant;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Case;
import com.yahoo.searchdefinition.document.MatchType;
@@ -1773,9 +1774,7 @@ void rankingConstant(ParsedSchema schema) :
<RBRACE>
)
{
- if (type == null) throw new IllegalArgumentException("constant '" + name + "' must have a type");
- if (path == null) throw new IllegalArgumentException("constant '" + name + "' must have a file");
- schema.add(new RankProfile.Constant(FeatureNames.asConstantFeature(name), type, path, pathType));
+ schema.addRankingConstant(new RankingConstant(name, type, path, pathType));
}
}
@@ -2454,9 +2453,9 @@ void constant(ParsedSchema schema, ParsedRankProfile profile) :
LOOKAHEAD(4) ( ( type = valueType(name) )? <COLON> (<NL>)* ( value = tensorValue(type) | valuePath = fileItem())
{
if (value != null)
- profile.add(new RankProfile.Constant(name, value));
+ profile.addConstant(name, new RankProfile.Constant(name, value));
else
- profile.add(new RankProfile.Constant(name, type, valuePath));
+ schema.addRankingConstant(new RankingConstant(name.simpleArgument().get(), type, valuePath, DistributableResource.PathType.FILE)); // TODO JON: Move to RankProfile
}
)
| // Deprecated forms (TODO: Add warning on Vespa 8):
@@ -2486,7 +2485,7 @@ void constantValue(ParsedRankProfile profile, Reference name) :
}
{
<COLON> ( value = <DOUBLE> | value = <INTEGER> | value = <IDENTIFIER> )
- { profile.add(new RankProfile.Constant(name, Tensor.from(value.image))); }
+ { profile.addConstant(name, new RankProfile.Constant(name, Tensor.from(value.image))); }
}
// Deprecated form
@@ -2499,7 +2498,8 @@ void constantTensor(ParsedRankProfile profile, Reference name) :
<LBRACE> (<NL>)*
(( tensorString = tensorValuePrefixedByValue() |
type = tensorTypeWithPrefix(constantTensorErrorMessage(profile.name(), name)) ) (<NL>)* )* <RBRACE>
- { profile.add(new RankProfile.Constant(name, type != null ? Tensor.from(type, tensorString) : Tensor.from(tensorString)));
+ { profile.addConstant(name,
+ new RankProfile.Constant(name, type != null ? Tensor.from(type, tensorString) : Tensor.from(tensorString)));
}
}