lance_namespace_reqwest_client/models/
create_table_index_request.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateTableIndexRequest {
16 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
17 pub id: Option<Vec<String>>,
18 #[serde(rename = "column")]
20 pub column: String,
21 #[serde(rename = "index_type")]
23 pub index_type: IndexType,
24 #[serde(rename = "metric_type", skip_serializing_if = "Option::is_none")]
26 pub metric_type: Option<MetricType>,
27 #[serde(rename = "with_position", skip_serializing_if = "Option::is_none")]
29 pub with_position: Option<bool>,
30 #[serde(rename = "base_tokenizer", skip_serializing_if = "Option::is_none")]
32 pub base_tokenizer: Option<String>,
33 #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
35 pub language: Option<String>,
36 #[serde(rename = "max_token_length", skip_serializing_if = "Option::is_none")]
38 pub max_token_length: Option<i32>,
39 #[serde(rename = "lower_case", skip_serializing_if = "Option::is_none")]
41 pub lower_case: Option<bool>,
42 #[serde(rename = "stem", skip_serializing_if = "Option::is_none")]
44 pub stem: Option<bool>,
45 #[serde(rename = "remove_stop_words", skip_serializing_if = "Option::is_none")]
47 pub remove_stop_words: Option<bool>,
48 #[serde(rename = "ascii_folding", skip_serializing_if = "Option::is_none")]
50 pub ascii_folding: Option<bool>,
51}
52
53impl CreateTableIndexRequest {
54 pub fn new(column: String, index_type: IndexType) -> CreateTableIndexRequest {
55 CreateTableIndexRequest {
56 id: None,
57 column,
58 index_type,
59 metric_type: None,
60 with_position: None,
61 base_tokenizer: None,
62 language: None,
63 max_token_length: None,
64 lower_case: None,
65 stem: None,
66 remove_stop_words: None,
67 ascii_folding: None,
68 }
69 }
70}
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
73pub enum IndexType {
74 #[serde(rename = "BTREE")]
75 Btree,
76 #[serde(rename = "BITMAP")]
77 Bitmap,
78 #[serde(rename = "LABEL_LIST")]
79 LabelList,
80 #[serde(rename = "IVF_FLAT")]
81 IvfFlat,
82 #[serde(rename = "IVF_PQ")]
83 IvfPq,
84 #[serde(rename = "IVF_HNSW_SQ")]
85 IvfHnswSq,
86 #[serde(rename = "FTS")]
87 Fts,
88}
89
90impl Default for IndexType {
91 fn default() -> IndexType {
92 Self::Btree
93 }
94}
95#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum MetricType {
98 #[serde(rename = "l2")]
99 L2,
100 #[serde(rename = "cosine")]
101 Cosine,
102 #[serde(rename = "dot")]
103 Dot,
104}
105
106impl Default for MetricType {
107 fn default() -> MetricType {
108 Self::L2
109 }
110}
111