quick_search/crates/quicksearch-gui/src/search_tab/help_window.rs

92 lines
3.9 KiB
Rust
Raw Normal View History

//! The floating search-syntax reference.
use super::*;
impl SearchTab {
pub(super) fn help_window_ui(&mut self, ctx: &egui::Context) {
let mut open = self.help_open;
egui::Window::new("Query syntax")
.open(&mut open)
.resizable(false)
.default_width(540.0)
.show(ctx, |ui| {
ui.label(
"Everything that is not a filter is matched as one phrase, in order. \
Filters combine freely with the search text.",
);
ui.add_space(6.0);
egui::Grid::new("query-syntax-table")
.num_columns(2)
.spacing([18.0, 5.0])
.striped(true)
.show(ui, |ui| {
let row = |ui: &mut egui::Ui, syntax: &str, meaning: &str| {
ui.monospace(syntax);
ui.label(meaning);
ui.end_row();
};
row(
ui,
"budget report",
"names, contents, and paths containing \"budget report\"",
);
row(
ui,
"\"exact phrase\"",
"quotes keep spaces, stars, and filter-like words literal",
);
row(
ui,
"bud*report",
"* matches any run of characters (within a line); \
also works in name: values",
);
row(
ui,
"regex:\"(foo|bar)\\d+\"",
"regular expression, matched against names, contents, \
and paths",
);
row(
ui,
"type:Document",
"file class: Audio, Image, Video, Document, Text, \
Archive, Spreadsheet, Presentation, Folder",
);
row(
ui,
"modified:>=2024-01-01",
"modification date (yyyy-mm-dd); also <, <=, > and =",
);
row(
ui,
"path:/home/me/docs",
"only results in that folder and its subfolders; \
quote paths containing spaces",
);
row(ui, "mime:application/pdf", "exact MIME type");
row(
ui,
"name:report",
"filename contains, applied as an unranked filter",
);
});
ui.add_space(6.0);
ui.label("Example:");
ui.monospace("type:Document modified:>=2024-01-01 quarterly budget");
ui.add_space(6.0);
ui.label(hint(
"Ranking: exact filename matches, then filename substrings, then \
full-text matches (ordered by occurrences), then fuzzy matches \
when enabled, and finally matches on the rest of the file path.",
));
ui.label(hint(
"The complete reference, including ranking details and the \
fuzzy edit budget, is the \"Query syntax\" section of \
README.md in the QuickSearch folder.",
));
});
self.help_open = open;
}
}