diff --git a/src/services/attribute_formatter.js b/src/services/attribute_formatter.js index b7498bece..f02e9f731 100644 --- a/src/services/attribute_formatter.js +++ b/src/services/attribute_formatter.js @@ -28,7 +28,7 @@ function formatAttrForSearch(attr, searchWithValue) { } function formatValue(val) { - if (!/[^\w_-]/.test(val)) { + if (!/[^\w_]/.test(val)) { return val; } else if (!val.includes('"')) { diff --git a/src/services/attributes.js b/src/services/attributes.js index 569c74013..8168dbe54 100644 --- a/src/services/attributes.js +++ b/src/services/attributes.js @@ -60,7 +60,11 @@ const BUILTIN_ATTRIBUTES = [ ]; function getNotesWithLabel(name, value) { - return searchService.searchNotes(formatAttrForSearch({type: 'label', name, value}, true)); + const query = formatAttrForSearch({type: 'label', name, value}, true); + return searchService.searchNotes(query, { + includeArchivedNotes: true, + ignoreHoistedNote: true + }); } function getNoteIdsWithLabels(names) { diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js index 502ce872e..282f88be3 100644 --- a/src/services/search/services/search.js +++ b/src/services/search/services/search.js @@ -136,8 +136,8 @@ function parseQueryToExpression(query, searchContext) { * @param {string} query * @return {Note[]} */ -function searchNotes(query) { - const searchResults = findResultsWithQuery(query, new SearchContext()); +function searchNotes(query, params = {}) { + const searchResults = findResultsWithQuery(query, new SearchContext(params)); return searchResults.map(sr => becca.notes[sr.noteId]); }