Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issues with app search on Linux by correcting the displayed app name and adding support for apps installed via Flatpak.
- Added helper functions to retrieve app paths, names, and icon paths.
- Changed the fuzzy search distance to be based on the query string length and updated the Trie key type.
- Updated the applications dependency revision in Cargo.toml.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src-tauri/src/local/application.rs | Refactored helper functions and search logic for Linux app support and fuzzy search improvements. |
| src-tauri/Cargo.toml | Updated the applications-rs dependency revision. |
| let mut results = self | ||
| .application_paths | ||
| .search_within_distance_scored(&query_string, 3); | ||
| .search_within_distance_scored(&query_string, query_string_len - 1); |
There was a problem hiding this comment.
Ensure query_string is not empty before subtracting 1 from its length to avoid potential underflow. Consider adding a check to use a safe default when query_string is empty.
There was a problem hiding this comment.
See:
if query_string.is_empty() {
return Ok(QueryResponse {
source: self.get_type(),
hits: Vec::new(),
total_hits: 0,
});
}| // app name -> app icon path | ||
| icons: HashMap<String, PathBuf>, | ||
| application_paths: Trie<String>, | ||
| application_paths: Trie<PathBuf>, |
There was a problem hiding this comment.
The Trie key type has been changed to PathBuf, but fuzzy search is performed using app names (String). Consider reverting the Trie key type back to String or converting PathBuf to String for consistency in fuzzy search.
| application_paths: Trie<PathBuf>, | |
| application_paths: Trie<String>, |
There was a problem hiding this comment.
The Trie key type has been changed to PathBuf
Trie, T is the type of the value, not the key. See https://docs.rs/fuzzy_prefix_search/latest/fuzzy_prefix_search/trie/struct.Trie.html#method.insert
What does this PR do
Fix the app search on Linux:
Rationale for this change
Standards checklist