Skip to content

Commit

Permalink
Merge pull request #32808 from vespa-engine/interns/magnus/subqueries
Browse files Browse the repository at this point in the history
feat: add subqueries feature to builtin features in schema LS
  • Loading branch information
theodorklauritzen authored Nov 8, 2024
2 parents 6079d3c + a91ab69 commit 4e4e464
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
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
}
}

0 comments on commit 4e4e464

Please sign in to comment.