From ee15db0ae13c55e233288155da19d32de4c9193c Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 10 Dec 2019 21:40:53 +0100 Subject: [PATCH] for title/content search does not make sense to search for protected notes --- src/services/build_search_query.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/build_search_query.js b/src/services/build_search_query.js index cf45638a4..54dbfc325 100644 --- a/src/services/build_search_query.js +++ b/src/services/build_search_query.js @@ -113,6 +113,11 @@ module.exports = function(filters, selectedColumns = 'notes.*') { condition = "NOT(" + condition + ")"; } + if (['text', 'title', 'content'].includes(filter.name)) { + // for title/content search does not make sense to search for protected notes + condition = `(${condition} AND notes.isProtected = 0)`; + } + where += condition; } else if ([">", ">=", "<", "<="].includes(filter.operator)) {