@@ -30,8 +30,8 @@ pub struct SearchQuery {
30
30
pub include : Option < bool > ,
31
31
/// Maximum amount of results
32
32
pub limit : Option < usize > ,
33
- /// Only include resources that have this resource as its ancestor
34
- pub parent : Option < String > ,
33
+ /// Only include resources that have one of these resources as its ancestor
34
+ pub parents : Option < Vec < String > > ,
35
35
/// Filter based on props, using tantivy QueryParser syntax.
36
36
/// e.g. `prop:val` or `prop:val~1` or `prop:val~1 AND prop2:val2`
37
37
/// See https://docs.rs/tantivy/latest/tantivy/query/struct.QueryParser.html
@@ -147,9 +147,14 @@ fn query_from_params(
147
147
) -> AtomicServerResult < impl Query > {
148
148
let mut query_list: Queries = Vec :: new ( ) ;
149
149
150
- if let Some ( parent) = & params. parent {
151
- let query = build_parent_query ( parent, fields, & appstate. store ) ?;
150
+ if let Some ( parents) = & params. parents {
151
+ let mut queries: Vec < Box < dyn Query > > = Vec :: new ( ) ;
152
+ for parent in parents {
153
+ let boxed_q = build_parent_query ( parent, fields, & appstate. store ) ?;
154
+ queries. push ( Box :: new ( boxed_q) ) ;
155
+ }
152
156
157
+ let query = BooleanQuery :: union ( queries) ;
153
158
query_list. push ( ( Occur :: Must , Box :: new ( query) ) ) ;
154
159
}
155
160
0 commit comments