Skip to main content

qdrant_edge/shard/
count.rs

1use schemars::JsonSchema;
2use crate::segment::types::Filter;
3use serde::{Deserialize, Serialize};
4use validator::Validate;
5
6/// Count Request
7/// Counts the number of points which satisfy the given filter.
8/// If filter is not provided, the count of all points in the collection will be returned.
9#[derive(Clone, Debug, PartialEq, Hash, Deserialize, Serialize, JsonSchema, Validate)]
10#[serde(rename_all = "snake_case")]
11pub struct CountRequestInternal {
12    /// Look only for points which satisfies this conditions
13    #[validate(nested)]
14    pub filter: Option<Filter>,
15    /// If true, count exact number of points. If false, count approximate number of points faster.
16    /// Approximate count might be unreliable during the indexing process. Default: true
17    #[serde(default = "CountRequestInternal::default_exact")]
18    pub exact: bool,
19}
20
21impl CountRequestInternal {
22    pub const fn default_exact() -> bool {
23        true
24    }
25}