diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-12 21:24:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 21:24:29 +0200 |
commit | 78e8952ad0ed18c026aaeb7c471dfc886ccde7cb (patch) | |
tree | 9634ca34296bf5cebd52bbdc38450e1e39a77383 /config-model/src/main/javacc | |
parent | 9128b9c93fd58be98409c59892470263f249ec0b (diff) |
Revert "Create distributable constants on deriving"
Diffstat (limited to 'config-model/src/main/javacc')
-rw-r--r-- | config-model/src/main/javacc/IntermediateParser.jj | 14 |
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))); } } |