summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/javacc
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-13 12:16:42 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-13 12:16:42 +0200
commit19490cfa6d60e35e83902b3e5d6803f8d0146af5 (patch)
treef7cc568f59801c07677324c09280acbed17a033e /config-model/src/main/javacc
parent79537b954556ba6985f2c59b4bc44b971a385eb0 (diff)
Revert "Merge pull request #22589 from vespa-engine/revert-22582-bratseth/constants-cleanup-take-2"
This reverts commit 79537b954556ba6985f2c59b4bc44b971a385eb0, reversing changes made to 1df3b3c59251bd4fd1b099ae5cfb4c280313e76d.
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 1fabe9c57c4..873196d8bda 100644
--- a/config-model/src/main/javacc/IntermediateParser.jj
+++ b/config-model/src/main/javacc/IntermediateParser.jj
@@ -24,7 +24,6 @@ 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;
@@ -1774,7 +1773,9 @@ void rankingConstant(ParsedSchema schema) :
<RBRACE>
)
{
- schema.addRankingConstant(new RankingConstant(name, type, path, pathType));
+ 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));
}
}
@@ -2453,9 +2454,9 @@ void constant(ParsedSchema schema, ParsedRankProfile profile) :
LOOKAHEAD(4) ( ( type = valueType(name) )? <COLON> (<NL>)* ( value = tensorValue(type) | valuePath = fileItem())
{
if (value != null)
- profile.addConstant(name, new RankProfile.Constant(name, value));
+ profile.add(new RankProfile.Constant(name, value));
else
- schema.addRankingConstant(new RankingConstant(name.simpleArgument().get(), type, valuePath, DistributableResource.PathType.FILE)); // TODO JON: Move to RankProfile
+ profile.add(new RankProfile.Constant(name, type, valuePath));
}
)
| // Deprecated forms (TODO: Add warning on Vespa 8):
@@ -2485,7 +2486,7 @@ void constantValue(ParsedRankProfile profile, Reference name) :
}
{
<COLON> ( value = <DOUBLE> | value = <INTEGER> | value = <IDENTIFIER> )
- { profile.addConstant(name, new RankProfile.Constant(name, Tensor.from(value.image))); }
+ { profile.add(new RankProfile.Constant(name, Tensor.from(value.image))); }
}
// Deprecated form
@@ -2498,8 +2499,7 @@ void constantTensor(ParsedRankProfile profile, Reference name) :
<LBRACE> (<NL>)*
(( tensorString = tensorValuePrefixedByValue() |
type = tensorTypeWithPrefix(constantTensorErrorMessage(profile.name(), name)) ) (<NL>)* )* <RBRACE>
- { profile.addConstant(name,
- new RankProfile.Constant(name, type != null ? Tensor.from(type, tensorString) : Tensor.from(tensorString)));
+ { profile.add(new RankProfile.Constant(name, type != null ? Tensor.from(type, tensorString) : Tensor.from(tensorString)));
}
}