Skip to main content

qdrant_edge/edge/requests/
facet.rs

1use crate::segment::json_path::JsonPath;
2use crate::segment::types::Filter;
3use crate::shard::facet::FacetRequestInternal;
4
5/// Facet request — counts the number of points for each unique value of a payload key.
6#[derive(Clone, Debug, PartialEq)]
7pub struct FacetRequest {
8    /// Payload key to facet on.
9    pub key: JsonPath,
10    /// Maximum number of facet hits to return. Default: 10.
11    pub limit: usize,
12    /// Look only for points which satisfy these conditions.
13    pub filter: Option<Filter>,
14    /// If true, count the exact number of points for each value.
15    /// If false, count the approximate number of points faster. Default: false.
16    pub exact: bool,
17}
18
19impl FacetRequest {
20    pub fn new(key: JsonPath) -> Self {
21        Self {
22            key,
23            limit: FacetRequestInternal::DEFAULT_LIMIT,
24            filter: None,
25            exact: false,
26        }
27    }
28}