Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F132249
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/rust/sorter.rs b/rust/sorter.rs
index 3cce282..f81f622 100644
--- a/rust/sorter.rs
+++ b/rust/sorter.rs
@@ -1,36 +1,36 @@
use super::matcher;
use rayon::prelude::*;
pub struct Match {
pub score: i64,
pub content: String,
}
pub struct Options {
pub pattern: String,
- pub minimun_score: i64,
+ pub minimum_score: i64,
}
impl Options {
pub fn new(pattern: String) -> Self {
Self {
pattern,
- minimun_score: 20,
+ minimum_score: 25,
}
}
}
pub fn sort_strings(options: Options, strings: Vec<String>) -> Vec<Match> {
let matcher = matcher::Matcher::new(options.pattern);
let mut matches = strings
.into_par_iter()
.map(|candidate| Match {
score: matcher.score(candidate.as_str()),
content: candidate,
})
- .filter(|m| m.score > 25)
+ .filter(|m| m.score > options.minimum_score)
.collect::<Vec<Match>>();
matches.par_sort_unstable_by(|a, b| a.score.cmp(&b.score));
matches
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, May 8, 4:58 PM (1 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9030
Default Alt Text
(1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment