import toastService from "./toast.js";
import appContext from "./app_context.js";
const helpText = `
Search tips - also see
- Just enter any text for full text search
@abc
- returns notes with label abc
@year=2019
- matches notes with label year
having value 2019
@rock @pop
- matches notes which have both rock
and pop
labels
@rock or @pop
- only one of the labels must be present
@year<=2000
- numerical comparison (also >, >=, <).
@dateCreated>=MONTH-1
- notes created in the last month
=handler
- will execute script defined in handler
relation to get results
`;
async function refreshSearch() {
// FIXME
const activeNode = appContext.getMainNoteTree().getActiveNode();
activeNode.load(true);
activeNode.setExpanded(true);
toastService.showMessage("Saved search note refreshed.");
}
function init() {
const hashValue = document.location.hash ? document.location.hash.substr(1) : ""; // strip initial #
if (hashValue.startsWith("search=")) {
showSearch();
doSearch(hashValue.substr(7));
}
}
export default {
refreshSearch,
init,
getHelpText: () => helpText
};