Skip to main content

yuru_core/
config.rs

1#[derive(Clone, Debug)]
2pub struct SearchConfig {
3    pub max_query_variants: usize,
4    pub max_search_keys_per_candidate: usize,
5    pub max_total_key_bytes_per_candidate: usize,
6    pub limit: usize,
7    pub top_b_for_quality_score: usize,
8    pub exact: bool,
9    pub extended: bool,
10    pub case_sensitive: bool,
11    pub disabled: bool,
12    pub no_sort: bool,
13    pub normalize: bool,
14    pub matcher_algo: MatcherAlgo,
15    pub tiebreaks: Vec<Tiebreak>,
16}
17
18#[derive(Clone, Copy, Debug, Eq, PartialEq)]
19pub enum MatcherAlgo {
20    Greedy,
21    FzfV1,
22    FzfV2,
23    Nucleo,
24}
25
26#[derive(Clone, Copy, Debug, Eq, PartialEq)]
27pub enum Tiebreak {
28    Length,
29    Chunk,
30    Pathname,
31    Begin,
32    End,
33    Index,
34}
35
36impl Default for SearchConfig {
37    fn default() -> Self {
38        Self {
39            max_query_variants: 8,
40            max_search_keys_per_candidate: 8,
41            max_total_key_bytes_per_candidate: 1024,
42            limit: 10,
43            top_b_for_quality_score: 1000,
44            exact: false,
45            extended: true,
46            case_sensitive: false,
47            disabled: false,
48            no_sort: false,
49            normalize: true,
50            matcher_algo: MatcherAlgo::Greedy,
51            tiebreaks: vec![Tiebreak::Length, Tiebreak::Index],
52        }
53    }
54}