summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/javacc
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-12 21:26:17 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-12 21:26:17 +0200
commitfa7c1ee9d68b01d4501f08b9ea937f066fb3e45e (patch)
tree23637dc005deb2410a773f9561d23b59d8b5461e /config-model/src/main/javacc
parentc6c407d234fe5b5e926f35bceb8e26d4298d3c4f (diff)
Revert "Revert "Create distributable constants on deriving""
This reverts commit 78e8952ad0ed18c026aaeb7c471dfc886ccde7cb.
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)));
}
}