note cache fixes after refactoring

This commit is contained in:
zadam
2020-05-17 10:11:19 +02:00
parent 60c2049729
commit 32eaafd024
13 changed files with 69 additions and 40 deletions

View File

@@ -1,5 +1,9 @@
"use strict";
const NoteSet = require('../note_set');
const noteCache = require('../../note_cache/note_cache');
const noteCacheService = require('../../note_cache/note_cache_service');
class NoteCacheFulltextExp {
constructor(tokens) {
this.tokens = tokens;
@@ -34,7 +38,7 @@ class NoteCacheFulltextExp {
}
for (const parentNote of note.parents) {
const title = getNoteTitle(note.noteId, parentNote.noteId).toLowerCase();
const title = noteCacheService.getNoteTitle(note.noteId, parentNote.noteId).toLowerCase();
const foundTokens = foundAttrTokens.slice();
for (const token of this.tokens) {
@@ -77,13 +81,13 @@ class NoteCacheFulltextExp {
searchDownThePath(note, tokens, path, resultNoteSet, searchContext) {
if (tokens.length === 0) {
const retPath = getSomePath(note, path);
const retPath = noteCacheService.getSomePath(note, path);
if (retPath) {
const noteId = retPath[retPath.length - 1];
searchContext.noteIdToNotePath[noteId] = retPath;
resultNoteSet.add(notes[noteId]);
resultNoteSet.add(noteCache.notes[noteId]);
}
return;
@@ -105,7 +109,7 @@ class NoteCacheFulltextExp {
}
for (const parentNote of note.parents) {
const title = getNoteTitle(note.noteId, parentNote.noteId).toLowerCase();
const title = noteCacheService.getNoteTitle(note.noteId, parentNote.noteId).toLowerCase();
const foundTokens = foundAttrTokens.slice();
for (const token of tokens) {