aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/ordering.rs
diff options
context:
space:
mode:
authorPatrick <pmarschik@users.noreply.github.com>2022-03-18 12:37:27 +0100
committerGitHub <noreply@github.com>2022-03-18 11:37:27 +0000
commitfae118a46ba23da5aed9f4436e16ba7677ecbb84 (patch)
tree5bb01db0358ac1d6fbba74d79b372b06019c0f2e /atuin-client/src/ordering.rs
parentAdd code of conduct (#281) (diff)
downloadatuin-fae118a46ba23da5aed9f4436e16ba7677ecbb84.zip
Improve fuzzy search (#279)
* Add SearchMode fzf. Add a new search mode "fzf" that tries to mimic the search syntax of https://github.com/junegunn/fzf#search-syntax This search mode splits the query into terms where each term is matched individually. Terms can have operators like prefix, suffix, exact match only and can be inverted. Additionally, smart-case matching is performed: if a term contains a non-lowercase letter the match will be case-sensitive. * PR feedback. - Use SearchMode::Fuzzy instead of SearchMode::Fzf - update docs - re-order tests so previous fuzzy tests come first, add more tests for each operator * PR comments: remove named arguments, match expression * PR comments: macro -> async func
Diffstat (limited to 'atuin-client/src/ordering.rs')
-rw-r--r--atuin-client/src/ordering.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/atuin-client/src/ordering.rs b/atuin-client/src/ordering.rs
index b6051d15..0bb12c6a 100644
--- a/atuin-client/src/ordering.rs
+++ b/atuin-client/src/ordering.rs
@@ -17,6 +17,7 @@ where
let mut r = res.clone();
let qvec = &query.chars().collect();
r.sort_by_cached_key(|h| {
+ // TODO for fzf search we should sum up scores for each matched term
let (from, to) = match minspan::span(qvec, &(f(h).chars().collect())) {
Some(x) => x,
// this is a little unfortunate: when we are asked to match a query that is found nowhere,