Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add subqueries feature to builtin features in schema LS #32808

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static enum FieldType {
NUMERIC_ARRAY,
STRING,
STRING_ARRAY,
POSITION
POSITION,
PREDICATE
};

public static final EnumSet<FieldType> AnyFieldType = EnumSet.allOf(FieldType.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ Stream<DynamicTest> 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}