From 55bda1cd71a7c1481c86a8bd022db484acd167d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 22 Apr 2018 23:11:23 +0200 Subject: [PATCH] search: levenshtein2 for word bigger than 8 chars --- Cargo.toml | 3 +++ src/bin/raptor.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0fe3f16a6..b9ffc60b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,3 +18,6 @@ tokio-minihttp = { git = "https://github.com/tokio-rs/tokio-minihttp.git" } tokio-proto = "0.1" tokio-service = "0.1" url = "1.7" + +[profile.release] +lto = true diff --git a/src/bin/raptor.rs b/src/bin/raptor.rs index 8bbb77fe2..125bb90a7 100644 --- a/src/bin/raptor.rs +++ b/src/bin/raptor.rs @@ -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("");