Skip to main content

qdrant_client/qdrant_client/conversions/
payloads.rs

1use crate::qdrant::payload_index_params::IndexParams;
2use crate::qdrant::{
3    BoolIndexParams, BoolIndexParamsBuilder, DatetimeIndexParams, DatetimeIndexParamsBuilder,
4    FloatIndexParams, FloatIndexParamsBuilder, GeoIndexParams, GeoIndexParamsBuilder,
5    IntegerIndexParams, IntegerIndexParamsBuilder, KeywordIndexParams, KeywordIndexParamsBuilder,
6    PayloadIndexParams, TextIndexParams, TextIndexParamsBuilder, TextScoringParams,
7    TextScoringType, UuidIndexParams, UuidIndexParamsBuilder,
8};
9
10impl From<TextScoringType> for TextScoringParams {
11    fn from(value: TextScoringType) -> Self {
12        Self {
13            r#type: value.into(),
14        }
15    }
16}
17
18impl From<IndexParams> for PayloadIndexParams {
19    fn from(value: IndexParams) -> Self {
20        Self {
21            index_params: Some(value),
22        }
23    }
24}
25
26impl From<TextIndexParams> for IndexParams {
27    fn from(value: TextIndexParams) -> Self {
28        Self::TextIndexParams(value)
29    }
30}
31
32impl From<TextIndexParamsBuilder> for IndexParams {
33    fn from(value: TextIndexParamsBuilder) -> Self {
34        Self::TextIndexParams(value.build())
35    }
36}
37
38impl From<TextIndexParams> for PayloadIndexParams {
39    fn from(value: TextIndexParams) -> Self {
40        Self {
41            index_params: Some(IndexParams::from(value)),
42        }
43    }
44}
45
46impl From<IntegerIndexParams> for IndexParams {
47    fn from(value: IntegerIndexParams) -> Self {
48        Self::IntegerIndexParams(value)
49    }
50}
51
52impl From<IntegerIndexParamsBuilder> for IndexParams {
53    fn from(value: IntegerIndexParamsBuilder) -> Self {
54        Self::IntegerIndexParams(value.build())
55    }
56}
57
58impl From<IntegerIndexParams> for PayloadIndexParams {
59    fn from(value: IntegerIndexParams) -> Self {
60        Self {
61            index_params: Some(IndexParams::from(value)),
62        }
63    }
64}
65
66impl From<KeywordIndexParams> for IndexParams {
67    fn from(value: KeywordIndexParams) -> Self {
68        Self::KeywordIndexParams(value)
69    }
70}
71
72impl From<KeywordIndexParamsBuilder> for IndexParams {
73    fn from(value: KeywordIndexParamsBuilder) -> Self {
74        Self::KeywordIndexParams(value.build())
75    }
76}
77
78impl From<FloatIndexParams> for IndexParams {
79    fn from(value: FloatIndexParams) -> Self {
80        Self::FloatIndexParams(value)
81    }
82}
83
84impl From<FloatIndexParamsBuilder> for IndexParams {
85    fn from(value: FloatIndexParamsBuilder) -> Self {
86        Self::FloatIndexParams(value.build())
87    }
88}
89
90impl From<DatetimeIndexParams> for IndexParams {
91    fn from(value: DatetimeIndexParams) -> Self {
92        Self::DatetimeIndexParams(value)
93    }
94}
95
96impl From<DatetimeIndexParamsBuilder> for IndexParams {
97    fn from(value: DatetimeIndexParamsBuilder) -> Self {
98        Self::DatetimeIndexParams(value.build())
99    }
100}
101
102impl From<UuidIndexParams> for IndexParams {
103    fn from(value: UuidIndexParams) -> Self {
104        Self::UuidIndexParams(value)
105    }
106}
107
108impl From<UuidIndexParamsBuilder> for IndexParams {
109    fn from(value: UuidIndexParamsBuilder) -> Self {
110        Self::UuidIndexParams(value.build())
111    }
112}
113
114impl From<BoolIndexParams> for IndexParams {
115    fn from(value: BoolIndexParams) -> Self {
116        Self::BoolIndexParams(value)
117    }
118}
119
120impl From<BoolIndexParamsBuilder> for IndexParams {
121    fn from(value: BoolIndexParamsBuilder) -> Self {
122        Self::BoolIndexParams(value.build())
123    }
124}
125
126impl From<GeoIndexParams> for IndexParams {
127    fn from(value: GeoIndexParams) -> Self {
128        Self::GeoIndexParams(value)
129    }
130}
131
132impl From<GeoIndexParamsBuilder> for IndexParams {
133    fn from(value: GeoIndexParamsBuilder) -> Self {
134        Self::GeoIndexParams(value.build())
135    }
136}