1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#![allow(clippy::too_many_lines)]
use crate::simple::{AutocompleteType, EddieMetric, RapidfuzzMetric, SearchIndex, SearchType, StrsimMetric};
// -----------------------------------------------------------------------------
//
/// Default values for a `SearchIndex`. These values can be overridden by using
/// `SearchIndex::new()` or `SearchIndexBuilder`.
impl<K: Ord> Default for SearchIndex<K> {
fn default() -> Self {
Self::new(
SearchType::Live, // Search type.
AutocompleteType::Context, // Autocompletion type.
Some(EddieMetric::Levenshtein), // String similarity metric type.
Some(RapidfuzzMetric::Osa), // String similarity metric type.
Some(StrsimMetric::Levenshtein), // String similarity metric type.
2, // String similarity match length.
0.3, // String similarity minimum score.
// Default split pattern:
Some(vec![
'\t', // Tab
'\n', // Newline
'\r', // Carriage return
' ', // Space
'!', // Exclamation Mark
'"', // Double quotation
'&', // Ampersand
'(', // Left Parenthesis
')', // Right Parenthesis
'*', // Asterisk
'+', // Plus Sign
',', // Comma
'-', // Minus Sign
'.', // Full Stop
'/', // Solidus
':', // Colon
';', // Semicolon
'<', // Less-Than Sign
'=', // Equals Sign
'>', // Greater-Than Sign
'?', // Question Mark
'[', // Left Square Bracket
'\\', // Reverse Solidus
']', // Right Square Bracket
'^', // Circumflex Accent
'`', // Grave Accent
'{', // Left Curly Bracket
'|', // Vertical Line
'}', // Right Curly Bracket
'~', // Tilde
' ', // No-Break Space
'¡', // Inverted Exclamation Mark
'«', // Left-Pointing Double Angle Quotation Mark
'»', // Right-Pointing Double Angle Quotation Mark
'¿', // Inverted Question Mark
'×', // Multiplication Sign
'÷', // Division Sign
'ˆ', // Modifier Letter Circumflex Accent
'‘', // Left Single Quotation Mark
'’', // Right Single Quotation Mark
'“', // Left Double Quotation Mark
'”', // Right Double Quotation Mark
'„', // Double Low-9 Quotation Mark
'‹', // Single Left-Pointing Angle Quotation Mark
'›', // Single Right-Pointing Angle Quotation Mark
'—', // Em Dash
'–', // En Dash, U+2013
'…', // Ellipsis, U+2026
'•', // Bullet, U+2022
'§', // Section Sign
'¶', // Pilcrow
]),
false, // Case sensitive?
1, // Minimum keyword length (in chars or codepoints.)
24, // Maximum keyword length (in chars or codepoints.)
Some(24), // Maximum text length (in chars or codepoints.)
// Default keywords to be excluded:
Some(vec![
// Some English:
"a".to_string(),
"an".to_string(),
"and".to_string(),
"as".to_string(),
"at".to_string(),
"but".to_string(),
"by".to_string(),
"for".to_string(),
"if".to_string(),
"in".to_string(),
"nor".to_string(),
"of".to_string(),
"off".to_string(),
"on".to_string(),
"or".to_string(),
"per".to_string(),
"so".to_string(),
"the".to_string(),
"to".to_string(),
"up".to_string(),
"via".to_string(),
"yet".to_string(),
// Some French:
"de".to_string(),
"en".to_string(),
"et".to_string(),
"la".to_string(),
"le".to_string(),
"les".to_string(),
"ni".to_string(),
"ou".to_string(),
"par".to_string(),
"pour".to_string(),
"si".to_string(),
"sur".to_string(),
"un".to_string(),
"une".to_string(),
"à".to_string(),
// Some Spanish:
"asi".to_string(),
"así".to_string(),
"aun".to_string(),
"aún".to_string(),
"del".to_string(),
"el".to_string(),
"las".to_string(),
"los".to_string(),
"o".to_string(),
"para".to_string(),
"por".to_string(),
"que".to_string(),
"sí".to_string(),
"tan".to_string(),
"una".to_string(),
"uno".to_string(),
"vía".to_string(),
"y".to_string(),
]),
5, // Maximum number of auto-complete options.
100, // Maximum number of search results.
40_960, // Maximum keys per keyword.
Some("\0".to_string()), // Dump keyword.
) // SearchIndex
} // fn
} // impl