qdrant_client/builders/
keyword_index_params_builder.rs1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct KeywordIndexParamsBuilder {
5 pub(crate) is_tenant: Option<Option<bool>>,
7 pub(crate) on_disk: Option<Option<bool>>,
9 pub(crate) enable_hnsw: Option<Option<bool>>,
11}
12
13impl Default for KeywordIndexParamsBuilder {
14 fn default() -> Self {
15 Self::create_empty()
16 }
17}
18
19impl KeywordIndexParamsBuilder {
20 pub fn is_tenant(self, value: bool) -> Self {
22 let mut new = self;
23 new.is_tenant = Option::Some(Option::Some(value));
24 new
25 }
26 pub fn on_disk(self, value: bool) -> Self {
28 let mut new = self;
29 new.on_disk = Option::Some(Option::Some(value));
30 new
31 }
32 pub fn enable_hnsw(self, value: bool) -> Self {
34 let mut new = self;
35 new.enable_hnsw = Option::Some(Option::Some(value));
36 new
37 }
38
39 fn build_inner(self) -> Result<KeywordIndexParams, std::convert::Infallible> {
40 Ok(KeywordIndexParams {
41 is_tenant: self.is_tenant.unwrap_or_default(),
42 on_disk: self.on_disk.unwrap_or_default(),
43 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
44 })
45 }
46 fn create_empty() -> Self {
48 Self {
49 is_tenant: core::default::Default::default(),
50 on_disk: core::default::Default::default(),
51 enable_hnsw: core::default::Default::default(),
52 }
53 }
54}
55
56impl From<KeywordIndexParamsBuilder> for KeywordIndexParams {
57 fn from(value: KeywordIndexParamsBuilder) -> Self {
58 value.build_inner().unwrap_or_else(|_| {
59 panic!(
60 "Failed to convert {0} to {1}",
61 "KeywordIndexParamsBuilder", "KeywordIndexParams"
62 )
63 })
64 }
65}
66
67impl KeywordIndexParamsBuilder {
68 pub fn build(self) -> KeywordIndexParams {
70 self.build_inner().unwrap_or_else(|_| {
71 panic!(
72 "Failed to build {0} into {1}",
73 "KeywordIndexParamsBuilder", "KeywordIndexParams"
74 )
75 })
76 }
77}