diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index 4ca958ca5..29b621535 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -109,6 +109,7 @@ button.close:hover { .icon-action { border: 1px solid transparent; + padding: 5px; width: 35px; height: 35px; cursor: pointer; diff --git a/src/services/search/expressions/ancestor.js b/src/services/search/expressions/ancestor.js index 169c95c6b..f48e9e59f 100644 --- a/src/services/search/expressions/ancestor.js +++ b/src/services/search/expressions/ancestor.js @@ -14,7 +14,7 @@ class AncestorExp extends Expression { this.ancestorDepthComparator = this.getComparator(ancestorDepth); } - execute(inputNoteSet, executionContext) { + execute(inputNoteSet, executionContext, searchContext) { const ancestorNote = becca.notes[this.ancestorNoteId]; if (!ancestorNote) { diff --git a/src/services/search/expressions/attribute_exists.js b/src/services/search/expressions/attribute_exists.js index f91c19b21..9e8e92f00 100644 --- a/src/services/search/expressions/attribute_exists.js +++ b/src/services/search/expressions/attribute_exists.js @@ -13,7 +13,7 @@ class AttributeExistsExp extends Expression { this.prefixMatch = prefixMatch; } - execute(inputNoteSet) { + execute(inputNoteSet, executionContext, searchContext) { const attrs = this.prefixMatch ? becca.findAttributesWithPrefix(this.attributeType, this.attributeName) : becca.findAttributes(this.attributeType, this.attributeName); diff --git a/src/services/search/expressions/label_comparison.js b/src/services/search/expressions/label_comparison.js index 1a462af74..79cf8cc3e 100644 --- a/src/services/search/expressions/label_comparison.js +++ b/src/services/search/expressions/label_comparison.js @@ -13,7 +13,7 @@ class LabelComparisonExp extends Expression { this.comparator = comparator; } - execute(inputNoteSet) { + execute(inputNoteSet, executionContext, searchContext) { const attrs = becca.findAttributes(this.attributeType, this.attributeName); const resultNoteSet = new NoteSet(); diff --git a/src/services/search/expressions/note_flat_text.js b/src/services/search/expressions/note_flat_text.js index ca5f2c59d..002992a51 100644 --- a/src/services/search/expressions/note_flat_text.js +++ b/src/services/search/expressions/note_flat_text.js @@ -12,7 +12,7 @@ class NoteFlatTextExp extends Expression { this.tokens = tokens; } - execute(inputNoteSet, executionContext) { + execute(inputNoteSet, executionContext, searchContext) { // has deps on SQL which breaks unit test so needs to be dynamically required const beccaService = require('../../../becca/becca_service'); const resultNoteSet = new NoteSet(); diff --git a/src/services/search/expressions/or.js b/src/services/search/expressions/or.js index 4aabb7a65..2927882af 100644 --- a/src/services/search/expressions/or.js +++ b/src/services/search/expressions/or.js @@ -25,11 +25,11 @@ class OrExp extends Expression { this.subExpressions = subExpressions; } - execute(inputNoteSet, executionContext) { + execute(inputNoteSet, executionContext, searchContext) { const resultNoteSet = new NoteSet(); for (const subExpression of this.subExpressions) { - resultNoteSet.mergeIn(subExpression.execute(inputNoteSet, executionContext)); + resultNoteSet.mergeIn(subExpression.execute(inputNoteSet, executionContext, searchContext)); } return resultNoteSet; diff --git a/src/services/search/expressions/property_comparison.js b/src/services/search/expressions/property_comparison.js index dc026fdcf..a53bd5eca 100644 --- a/src/services/search/expressions/property_comparison.js +++ b/src/services/search/expressions/property_comparison.js @@ -5,8 +5,8 @@ const NoteSet = require('../note_set'); const buildComparator = require("../services/build_comparator"); /** - * Search string is lower cased for case insensitive comparison. But when retrieving properties - * we need case sensitive form so we have this translation object. + * Search string is lower cased for case-insensitive comparison. But when retrieving properties + * we need case-sensitive form, so we have this translation object. */ const PROP_MAPPING = { "noteid": "noteId", @@ -53,7 +53,7 @@ class PropertyComparisonExp extends Expression { } } - execute(inputNoteSet, executionContext) { + execute(inputNoteSet, executionContext, searchContext) { const resNoteSet = new NoteSet(); for (const note of inputNoteSet.notes) { diff --git a/src/services/search/expressions/true.js b/src/services/search/expressions/true.js index 1ffab8bf1..fd685cc17 100644 --- a/src/services/search/expressions/true.js +++ b/src/services/search/expressions/true.js @@ -3,7 +3,7 @@ const Expression = require('./expression'); class TrueExp extends Expression { - execute(inputNoteSet, executionContext) { + execute(inputNoteSet, executionContext, searchContext) { return inputNoteSet; } } diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js index 145200e78..954817c78 100644 --- a/src/services/search/services/search.js +++ b/src/services/search/services/search.js @@ -151,6 +151,9 @@ function findResultsWithExpression(expression, searchContext) { noteIdToNotePath: {} }; + const ancestorNote = becca.getNote(searchContext.ancestorNoteId || 'root'); + const showNotesInHiddenSubtree = ancestorNote.hasAncestor('_hidden'); + const noteSet = expression.execute(allNoteSet, executionContext, searchContext); const searchResults = noteSet.notes @@ -165,7 +168,7 @@ function findResultsWithExpression(expression, searchContext) { throw new Error(`Can't find note path for note ${JSON.stringify(note.getPojo())}`); } - if (notePathArray.includes('_hidden')) { + if (!showNotesInHiddenSubtree && notePathArray.includes('_hidden')) { return null; }