Skip to main content

qdrant_edge/edge/requests/
grouping.rs

1use crate::segment::json_path::JsonPath;
2
3use crate::edge::requests::query::QueryRequest;
4
5/// Group the results of a base query by a payload field.
6#[derive(Clone, Debug, PartialEq)]
7pub struct GroupRequest {
8    /// Base scoring query. Its `limit`/`offset`/`with_payload`/`filter` are adjusted
9    /// by the grouping driver; the query vector, params, prefetch and score_threshold
10    /// are honoured.
11    pub query: QueryRequest,
12    /// Payload field to group by.
13    pub group_by: JsonPath,
14    /// Maximum number of groups to return.
15    pub groups: usize,
16    /// Maximum number of hits per group.
17    pub group_size: usize,
18}
19
20impl GroupRequest {
21    pub fn new(query: QueryRequest, group_by: JsonPath, groups: usize, group_size: usize) -> Self {
22        Self {
23            query,
24            group_by,
25            groups,
26            group_size,
27        }
28    }
29}