mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
search: levenshtein2 for word bigger than 8 chars
This commit is contained in:
parent
b729c76bce
commit
55bda1cd71
2 changed files with 8 additions and 1 deletions
|
@ -54,7 +54,11 @@ impl Service for MainService {
|
|||
if let Some((_, key)) = url.query_pairs().find(|&(ref k, _)| k == "q") {
|
||||
let key = key.to_lowercase();
|
||||
|
||||
let lev = Levenshtein::new(&key, 2).unwrap();
|
||||
let lev = if key.len() <= 8 {
|
||||
Levenshtein::new(&key, 1).unwrap()
|
||||
} else {
|
||||
Levenshtein::new(&key, 2).unwrap()
|
||||
};
|
||||
|
||||
let mut body = String::new();
|
||||
body.push_str("<html><body>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue