mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +08:00
search: levenshtein2 for word bigger than 8 chars
This commit is contained in:
parent
b729c76bce
commit
55bda1cd71
@ -18,3 +18,6 @@ tokio-minihttp = { git = "https://github.com/tokio-rs/tokio-minihttp.git" }
|
|||||||
tokio-proto = "0.1"
|
tokio-proto = "0.1"
|
||||||
tokio-service = "0.1"
|
tokio-service = "0.1"
|
||||||
url = "1.7"
|
url = "1.7"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
@ -54,7 +54,11 @@ impl Service for MainService {
|
|||||||
if let Some((_, key)) = url.query_pairs().find(|&(ref k, _)| k == "q") {
|
if let Some((_, key)) = url.query_pairs().find(|&(ref k, _)| k == "q") {
|
||||||
let key = key.to_lowercase();
|
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();
|
let mut body = String::new();
|
||||||
body.push_str("<html><body>");
|
body.push_str("<html><body>");
|
||||||
|
Loading…
Reference in New Issue
Block a user