Implemented search history for application plugin#116
Implemented search history for application plugin#116peppidesu wants to merge 7 commits intoanyrun-org:masterfrom
Conversation
|
That sounds amazing! |
|
Any update on this useful feature? |
Kirottu
left a comment
There was a problem hiding this comment.
Since the PR is quite old, it needs a rebase for me to try it out. Alongside with the other comments that should be addressed.
| pub fn load() -> Self { | ||
|
|
||
| let path = format!( | ||
| "{}/.cache/anyrun-applications-history", |
There was a problem hiding this comment.
Should be ~/.cache/anyrun/applications-history in line with what the nix-run plugin uses.
|
|
||
| let path = format!( | ||
| "{}/.cache/anyrun-applications-history", | ||
| env::var("HOME").expect("Unable to determine HOME directory") |
There was a problem hiding this comment.
Prefer $XDG_CACHE_HOME, and use $HOME/.cache as a fallback.
| desktop_actions: false, | ||
| max_entries: 5, | ||
| terminal: None, | ||
| history_size: 50, |
There was a problem hiding this comment.
Should be an optional, in a way that None will disable the history alltogether.
|
|
||
| State { config, entries } | ||
| let history = history::History::load(); | ||
| println!("Loaded {} history entries", history.count()); |
There was a problem hiding this comment.
Should be eprintln!("[applications] ...", ...);
| let mut score = (app_score * 25 + keyword_score) - entry.offset; | ||
| let history_score = state.history.get_entry_info(entry).map(|(index, count)| { | ||
| let recency_bias = i64::max(5-index as i64, 0); | ||
| (count as i64 + recency_bias) * 20 |
There was a problem hiding this comment.
Since the weighting has changed recently, this likely needs different weighting to make it work properly.
|
Hi, i did a rebase recently for my personal fork which includes this feature. I first want to make some improvements on this because the current algorithm is quite naive. |
Issue #14 discussed this feature before, but the branch the maintainer mentioned is out of date by 74 commits.
This pull request implements recency bias into the applications plugin, meaning recently / commonly searched applications will be prioritized. The history file is stored in
$HOME/.cache/anyrun-applications-history. The maximum number of entries can be changed in the config file usinghistory_size(see README.md).Recency bias is only applied if the other score components are not 0 (to prevent unrelated results showing up) and when the input field is empty.