quick search widget WIP

This commit is contained in:
zadam
2021-01-31 22:45:45 +01:00
parent 2ac78c2e03
commit 9447d3f9b5
5 changed files with 113 additions and 3 deletions

View File

@@ -200,6 +200,19 @@ async function searchFromRelation(note, relationName) {
return typeof result[0] === 'string' ? result : result.map(item => item.noteId);
}
function quickSearch(req) {
const {searchString} = req.params;
const searchContext = new SearchContext({
fastSearch: false,
includeArchivedNotes: false,
fuzzyAttributeSearch: false
});
return searchService.findNotesWithQuery(searchString, searchContext)
.map(sr => sr.noteId);
}
function getRelatedNotes(req) {
const attr = req.body;
@@ -276,5 +289,6 @@ function formatValue(val) {
module.exports = {
searchFromNote,
searchAndExecute,
getRelatedNotes
getRelatedNotes,
quickSearch
};