mirror of
https://github.com/solaeus/nucleo.git
synced 2024-11-12 18:17:11 +00:00
fix sort order of literal matcher (#13)
This commit is contained in:
parent
685e699bc5
commit
f18c19cd53
@ -2,7 +2,7 @@
|
||||
name = "nucleo"
|
||||
description = "plug and play high performance fuzzy matcher"
|
||||
authors = ["Pascal Kuthe <pascal.kuthe@semimod.de>"]
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/helix-editor/nucleo"
|
||||
|
@ -345,6 +345,6 @@ pub fn fuzzy_match<T: AsRef<str>>(
|
||||
.map(|score| (item, score))
|
||||
})
|
||||
.collect();
|
||||
items.sort_by_key(|(item, score)| (Reverse(*score), item.as_ref().len()));
|
||||
items.sort_by_key(|(_, score)| Reverse(*score));
|
||||
items
|
||||
}
|
||||
|
@ -373,7 +373,9 @@ impl Pattern {
|
||||
self.atoms.clear();
|
||||
let pattern =
|
||||
PatternAtom::literal(pattern, self.normalize, self.case_matching, kind, false);
|
||||
self.atoms.push(pattern);
|
||||
if !pattern.needle.is_empty() {
|
||||
self.atoms.push(pattern);
|
||||
}
|
||||
self.status = if append && self.status != Status::Rescore {
|
||||
Status::Update
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user