Skip to content

Commit

Permalink
feat: add subqueries feature to builtin features in schema LS
Browse files Browse the repository at this point in the history
  • Loading branch information
Mangern committed Nov 7, 2024
1 parent f8145a2 commit a91ab69
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 a91ab69

Please sign in to comment.