diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-04-05 21:28:52 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-04-05 21:28:52 +0200 |
commit | a9e01024cd979c748ba7f60560549f3dda9113ab (patch) | |
tree | 1a9a8a8c9de5608781bb75bfe94c038027c5e8e8 /config-model/src/main/javacc | |
parent | 1f55e277b55215f00fc1bafccb851369e28e4cd5 (diff) |
Support input in intermediate parser
Diffstat (limited to 'config-model/src/main/javacc')
-rw-r--r-- | config-model/src/main/javacc/IntermediateParser.jj | 30 | ||||
-rw-r--r-- | config-model/src/main/javacc/SDParser.jj | 2 |
2 files changed, 29 insertions, 3 deletions
diff --git a/config-model/src/main/javacc/IntermediateParser.jj b/config-model/src/main/javacc/IntermediateParser.jj index 6119eb5e2ce..68b11178cc2 100644 --- a/config-model/src/main/javacc/IntermediateParser.jj +++ b/config-model/src/main/javacc/IntermediateParser.jj @@ -39,6 +39,7 @@ import com.yahoo.searchdefinition.document.Stemming; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.searchdefinition.fieldoperation.IndexingOperation; import com.yahoo.searchlib.rankingexpression.FeatureList; +import com.yahoo.searchlib.rankingexpression.Reference; import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue; import com.yahoo.searchlib.rankingexpression.evaluation.Value; import com.yahoo.tensor.Tensor; @@ -174,6 +175,7 @@ TOKEN : | < WEIGHT: "weight" > | < TYPE: "type" > | < INDEX: "index" > +| < INPUTS: "inputs"> | < MTOKEN: "token" > | < TEXT: "text" > | < WORD: "word" > @@ -187,6 +189,7 @@ TOKEN : | < ONNXMODEL: "onnx-model"> | < MODEL: "model" > | < MUTATE: "mutate" > +| < QUERY: "query" > | < RANKPROFILE: "rank-profile" > | < RANKDEGRADATIONFREQ: "rank-degradation-frequency" > | < RANKDEGRADATION: "rank-degradation" > @@ -1832,6 +1835,7 @@ void rankProfileItem(ParsedRankProfile profile) : { } | rankProperties(profile) | secondPhase(profile) | rankDegradation() + | inputs(profile) | constants(profile) | matchFeatures(profile) | summaryFeatures(profile) @@ -2048,6 +2052,26 @@ void secondPhaseItem(ParsedRankProfile profile) : ) } +/** Consumes an inputs block of a rank profile. */ +void inputs(ParsedRankProfile profile) : +{ + Reference reference; + TensorType type; +} +{ + <INPUTS> <LBRACE> (<NL>)* + ( reference = queryFeature() <COLON> type = tensorType("Type of " + reference) { profile.addInput(reference, type); } (<NL>)*) * + <RBRACE> +} + +Reference queryFeature() : +{ + String argument; +} +{ + <QUERY> "(" argument = identifier() ")" + { return Reference.simple("query", argument); } +} /** * This rule consumes a summary-features block of a rank profile. @@ -2488,6 +2512,8 @@ String identifier() : { } | <COMPRESSION> | <COMPRESSIONLEVEL> | <COMPRESSIONTHRESHOLD> + | <CONSTANT> + | <CONSTANTS> | <CONTEXT> | <CREATEIFNONEXISTENT> | <DENSEPOSTINGLISTTHRESHOLD> @@ -2526,6 +2552,8 @@ String identifier() : { } | <INDEXING> | <INDEXINGREWRITE> | <INHERITS> + | <INLINE> + | <INPUTS> | <INTEGER> | <KEEPRANKCOUNT> | <LITERAL> @@ -2601,8 +2629,6 @@ String identifier() : { } | <WEIGHT> | <WEIGHTEDSET> | <WORD> - | <INLINE> - | <CONSTANTS> ) { return token.image; } } diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index 724239fc9b7..c0a7113239e 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -44,9 +44,9 @@ import com.yahoo.searchdefinition.DocumentOnlySchema; import com.yahoo.searchdefinition.UnrankedRankProfile; import com.yahoo.searchdefinition.fieldoperation.*; import com.yahoo.searchlib.rankingexpression.FeatureList; +import com.yahoo.searchlib.rankingexpression.Reference; import com.yahoo.searchlib.rankingexpression.evaluation.Value; import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue; -import com.yahoo.searchlib.rankingexpression.Reference; import com.yahoo.tensor.Tensor; import com.yahoo.tensor.TensorType; import com.yahoo.vespa.documentmodel.DocumentSummary; |