From 97eff1f15dcafe4a8d0229fa36b3e0448de2f4d6 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 21 Feb 2024 14:31:27 +0000 Subject: allow inputs { query(foo) string } --- config-model/src/main/javacc/SchemaParser.jj | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'config-model/src/main/javacc') diff --git a/config-model/src/main/javacc/SchemaParser.jj b/config-model/src/main/javacc/SchemaParser.jj index f298293ed57..d769f6208aa 100644 --- a/config-model/src/main/javacc/SchemaParser.jj +++ b/config-model/src/main/javacc/SchemaParser.jj @@ -34,6 +34,7 @@ import com.yahoo.schema.document.Stemming; import com.yahoo.schema.document.SDField; import com.yahoo.schema.FeatureNames; import com.yahoo.schema.fieldoperation.IndexingOperation; +import com.yahoo.search.schema.RankProfile.InputType; import com.yahoo.searchlib.rankingexpression.FeatureList; import com.yahoo.searchlib.rankingexpression.Reference; import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue; @@ -298,6 +299,7 @@ TOKEN : | < HNSW: "hnsw" > | < MAX_LINKS_PER_NODE: "max-links-per-node" > | < DOUBLE_KEYWORD: "double" > +| < STRING_KEYWORD: "string" > | < DISTANCE_METRIC: "distance-metric" > | < NEIGHBORS_TO_EXPLORE_AT_INSERT: "neighbors-to-explore-at-insert" > | < MULTI_THREADED_INDEXING: "multi-threaded-indexing" > @@ -2012,11 +2014,11 @@ void inputs(ParsedRankProfile profile) : void input(ParsedRankProfile profile) : { Reference reference; - TensorType type = TensorType.empty; + InputType type = new InputType(TensorType.empty, false); Tensor defaultValue = null; } { - reference = inputName() ( type = valueType(reference))? ( ()* defaultValue = tensorValue(type) )? + reference = inputName() ( type = valueType(reference))? ( ()* defaultValue = tensorValue(type.tensorType()) )? { profile.addInput(reference, new RankProfile.Input(reference, type, Optional.ofNullable(defaultValue))); } } @@ -2034,18 +2036,20 @@ Reference inputName() : { return FeatureNames.asQueryFeature(name); } } -TensorType valueType(Reference reference) : +InputType valueType(Reference reference) : { TensorType type; - + InputType result; } { ( - ( type = tensorType("Type of " + reference) ) + ( type = tensorType("Type of " + reference) { result = new InputType(type, false); } ) + | + ( { result = new InputType(TensorType.empty, false); } ) | - ( { type = TensorType.empty; } ) + ( { result = new InputType(TensorType.empty, true); } ) ) - { return type; } + { return result; } } /** @@ -2329,7 +2333,7 @@ void constants(ParsedSchema schema, ParsedRankProfile profile) : void constant(ParsedSchema schema, ParsedRankProfile profile) : { Reference name = null; - TensorType type = TensorType.empty; + InputType type = new InputType(TensorType.empty, false); Tensor value = null; String valuePath = null; } @@ -2337,12 +2341,12 @@ void constant(ParsedSchema schema, ParsedRankProfile profile) : ( name = constantName() ( - LOOKAHEAD(4) ( ( type = valueType(name) )? ()* ( value = tensorValue(type) | valuePath = fileItem()) + LOOKAHEAD(4) ( ( type = valueType(name) )? ()* ( value = tensorValue(type.tensorType()) | valuePath = fileItem()) { if (value != null) profile.add(new RankProfile.Constant(name, value)); else - profile.add(new RankProfile.Constant(name, type, valuePath)); + profile.add(new RankProfile.Constant(name, type.tensorType(), valuePath)); } ) | // Deprecated forms (TODO: Vespa > 8: Add warning): @@ -2710,6 +2714,7 @@ String identifier() : { } | | | + | | | | -- cgit v1.2.3