1// TODO: Update the default search mode to get from config
2#[derive(Copy, Clone, Debug, Default, PartialEq)]
3pub enum SearchMode {
4 #[default]
5 Text,
6 Semantic,
7 Regex,
8}
9
10impl SearchMode {
11 pub(crate) fn label(&self) -> &'static str {
12 match self {
13 SearchMode::Text => "Text",
14 SearchMode::Semantic => "Semantic",
15 SearchMode::Regex => "Regex",
16 }
17 }
18}
19
20pub(crate) fn next_mode(mode: &SearchMode, semantic_enabled: bool) -> SearchMode {
21 match mode {
22 SearchMode::Text => SearchMode::Regex,
23 SearchMode::Regex => {
24 if semantic_enabled {
25 SearchMode::Semantic
26 } else {
27 SearchMode::Text
28 }
29 }
30 SearchMode::Semantic => SearchMode::Text,
31 }
32}