diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/BuiltInFunctions.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/BuiltInFunctions.java index 21a1290cf642..bef06a81c928 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/BuiltInFunctions.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/BuiltInFunctions.java @@ -336,6 +336,17 @@ public class BuiltInFunctions { put("onnxModel", new GenericFunction("onnxModel", new FunctionSignature(new SymbolArgument(SymbolType.ONNX_MODEL, "onnx-model")))); put("lightgbm", new GenericFunction("lightgbm", new FunctionSignature(new StringArgument("\"/path/to/lightgbm-model.json\"")))); put("xgboost", new GenericFunction("xgboost", new FunctionSignature(new StringArgument("\"/path/to/xgboost-model.json\"")))); + + // TODO: I think this needs to be inside summary-features + // https://docs.vespa.ai/en/predicate-fields.html#identifying-subqueries-in-results + put("subqueries", new GenericFunction("subqueries", new FunctionSignature( + new FieldArgument(FieldType.PREDICATE), + Set.of( + "", + "lsb", + "msb" + ) + ))); }}; // Some features that have not gotten a signature for various reasons diff --git a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/argument/FieldArgument.java b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/argument/FieldArgument.java index 8c7130101a45..515bef9cb827 100644 --- a/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/argument/FieldArgument.java +++ b/integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/RankExpression/argument/FieldArgument.java @@ -25,7 +25,8 @@ public static enum FieldType { NUMERIC_ARRAY, STRING, STRING_ARRAY, - POSITION + POSITION, + PREDICATE }; public static final EnumSet AnyFieldType = EnumSet.allOf(FieldType.class); diff --git a/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java b/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java index 03da9451ced1..5c62efecccf0 100644 --- a/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java +++ b/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java @@ -263,6 +263,7 @@ Stream generateGoodFileTests() { "src/test/sdfiles/single/structinfieldset.sd", "src/test/sdfiles/single/attributeposition.sd", "src/test/sdfiles/single/defaultdefault.sd", + "src/test/sdfiles/single/subqueries.sd", }; return Arrays.stream(filePaths) diff --git a/integration/schema-language-server/language-server/src/test/sdfiles/single/subqueries.sd b/integration/schema-language-server/language-server/src/test/sdfiles/single/subqueries.sd new file mode 100644 index 000000000000..3c63090eb5ed --- /dev/null +++ b/integration/schema-language-server/language-server/src/test/sdfiles/single/subqueries.sd @@ -0,0 +1,16 @@ +schema subqueries { + document subqueries { + field predicate_field type predicate { + indexing: attribute + index { + arity: 2 + lower-bound: 3 + upper-bound: 200 + dense-posting-list-threshold: 0.25 + } + } + } + rank-profile default { + summary-features: subqueries(predicate_field).lsb subqueries(predicate_field).msb + } +}