mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix searching by label
This commit is contained in:
parent
8d3a3d4873
commit
e25b965cb3
@ -28,7 +28,7 @@ function formatAttrForSearch(attr, searchWithValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(val) {
|
function formatValue(val) {
|
||||||
if (!/[^\w_-]/.test(val)) {
|
if (!/[^\w_]/.test(val)) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
else if (!val.includes('"')) {
|
else if (!val.includes('"')) {
|
||||||
|
@ -60,7 +60,11 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function getNotesWithLabel(name, value) {
|
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) {
|
function getNoteIdsWithLabels(names) {
|
||||||
|
@ -136,8 +136,8 @@ function parseQueryToExpression(query, searchContext) {
|
|||||||
* @param {string} query
|
* @param {string} query
|
||||||
* @return {Note[]}
|
* @return {Note[]}
|
||||||
*/
|
*/
|
||||||
function searchNotes(query) {
|
function searchNotes(query, params = {}) {
|
||||||
const searchResults = findResultsWithQuery(query, new SearchContext());
|
const searchResults = findResultsWithQuery(query, new SearchContext(params));
|
||||||
|
|
||||||
return searchResults.map(sr => becca.notes[sr.noteId]);
|
return searchResults.map(sr => becca.notes[sr.noteId]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user