feat: Make typo factor configurable
Fixes https://github.com/valeriansaliou/sonic/issues/394.
This commit is contained in:
1 parent
0f79d0dab8
commit
9bdd4a2024
11 files changed
+120
-13
No files matched your search
@@ -72,6 +72,8 @@ fn query(query, app_config) -> [doc] {
|
||||
if update_score(results_matrix, doc, score, index, len(normalized(query))):
|
||||
alternates_try -= 1
|
||||
|
||||
// Thresholds are configured by `search.typo_factor_word_lengths`
|
||||
// (shown with the default value: `[4, 7, 10]`).
|
||||
fn typo_factor(word_len) -> u32 {
|
||||
if word_len <= 3: return 0
|
||||
else if word_len <= 6: return 1
|
||||
|
||||
Reference in new issue
Block a user