Skip to main content

qdrant_edge/shard/
scroll.rs

1use schemars::JsonSchema;
2use crate::segment::data_types::order_by::OrderByInterface;
3use crate::segment::types::{Filter, PointIdType, WithPayloadInterface, WithVector};
4use serde::{Deserialize, Serialize};
5use validator::Validate;
6
7/// Scroll request - paginate over all points which matches given condition
8#[derive(Clone, Debug, PartialEq, Hash, Deserialize, Serialize, JsonSchema, Validate)]
9#[serde(rename_all = "snake_case")]
10pub struct ScrollRequestInternal {
11    /// Start ID to read points from.
12    pub offset: Option<PointIdType>,
13
14    /// Page size. Default: 10
15    #[validate(range(min = 1))]
16    pub limit: Option<usize>,
17
18    /// Look only for points which satisfies this conditions. If not provided - all points.
19    #[validate(nested)]
20    pub filter: Option<Filter>,
21
22    /// Select which payload to return with the response. Default is true.
23    pub with_payload: Option<WithPayloadInterface>,
24
25    /// Options for specifying which vectors to include into response. Default is false.
26    #[serde(default, alias = "with_vectors")]
27    pub with_vector: WithVector,
28
29    /// Order the records by a payload field.
30    pub order_by: Option<OrderByInterface>,
31}
32
33impl Default for ScrollRequestInternal {
34    fn default() -> Self {
35        ScrollRequestInternal {
36            offset: None,
37            limit: Some(Self::default_limit()),
38            filter: None,
39            with_payload: Some(Self::default_with_payload()),
40            with_vector: Self::default_with_vector(),
41            order_by: None,
42        }
43    }
44}
45
46impl ScrollRequestInternal {
47    pub const fn default_limit() -> usize {
48        10
49    }
50
51    pub const fn default_with_payload() -> WithPayloadInterface {
52        WithPayloadInterface::Bool(true)
53    }
54
55    pub const fn default_with_vector() -> WithVector {
56        WithVector::Bool(false)
57    }
58}