mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
search fixes WIP
This commit is contained in:
@@ -79,7 +79,6 @@ class NoteRevision extends Entity {
|
||||
}
|
||||
|
||||
this.content = res.content;
|
||||
|
||||
if (this.isProtected) {
|
||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||
this.content = protectedSessionService.decrypt(this.content);
|
||||
|
||||
@@ -25,7 +25,7 @@ function set(key, value) {
|
||||
}
|
||||
|
||||
function getHoistedNoteId() {
|
||||
return namespace.get('hoistedNoteId');
|
||||
return namespace.get('hoistedNoteId') || 'root';
|
||||
}
|
||||
|
||||
function getSourceId() {
|
||||
|
||||
@@ -9,7 +9,7 @@ class LabelComparisonExp extends Expression {
|
||||
super();
|
||||
|
||||
this.attributeType = attributeType;
|
||||
this.attributeName = attributeName;
|
||||
this.attributeName = attributeName.toLowerCase();
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@ class LabelComparisonExp extends Expression {
|
||||
|
||||
for (const attr of attrs) {
|
||||
const note = attr.note;
|
||||
const value = attr.value ? attr.value.toLowerCase() : attr.value;
|
||||
|
||||
if (inputNoteSet.hasNoteId(note.noteId) && this.comparator(attr.value)) {
|
||||
if (inputNoteSet.hasNoteId(note.noteId) && this.comparator(value)) {
|
||||
if (attr.isInheritable) {
|
||||
resultNoteSet.addAll(note.subtreeNotesIncludingTemplated);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,15 @@ function findNotesWithExpression(expression, searchContext) {
|
||||
const noteSet = expression.execute(allNoteSet, executionContext);
|
||||
|
||||
const searchResults = noteSet.notes
|
||||
.map(note => executionContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note))
|
||||
.map(note => {
|
||||
const zzz = executionContext.noteIdToNotePath[note.noteId] || noteCacheService.getSomePath(note)
|
||||
|
||||
if (!zzz) {
|
||||
console.log("missing path", note);
|
||||
}
|
||||
|
||||
return zzz;
|
||||
})
|
||||
.filter(notePathArray => notePathArray.includes(cls.getHoistedNoteId()))
|
||||
.map(notePathArray => new SearchResult(notePathArray));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user