Skip to content

Build your personal knowledge base with Trilium Notes

fix searchForNotes API method to look for archived notes as well

zadam43ac712fcaa0
diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.js
index 1475f85e98..b3da91cc0a 100644
--- a/src/public/app/services/frontend_script_api.js
+++ b/src/public/app/services/frontend_script_api.js
@@ -1,4 +1,3 @@
-import treeService from './tree.js';
import server from './server.js';
import utils from './utils.js';
import toastService from './toast.js';
@@ -9,7 +8,6 @@ import protectedSessionService from './protected_session.js';
import dateNotesService from './date_notes.js';
import CollapsibleWidget from '../widgets/collapsible_widget.js';
import ws from "./ws.js";
-import hoistedNoteService from "./hoisted_note.js";
import appContext from "./app_context.js";
import TabAwareWidget from "../widgets/tab_aware_widget.js";
import TabCachingWidget from "../widgets/tab_caching_widget.js";
diff --git a/src/public/app/services/split.js b/src/public/app/services/split.js
index 2512eaae31..8923e565a8 100644
--- a/src/public/app/services/split.js
+++ b/src/public/app/services/split.js
@@ -24,8 +24,6 @@ function setupSplit(left, right) {
rightPaneWidth = 5;
}
- console.log(leftPaneWidth, rightPaneWidth);
-
if (left && right) {
instance = Split(['#left-pane', '#center-pane', '#right-pane'], {
sizes: [leftPaneWidth, 100 - leftPaneWidth - rightPaneWidth, rightPaneWidth],
diff --git a/src/public/app/services/tab_manager.js b/src/public/app/services/tab_manager.js
index b1782dc5f4..5ff30bc399 100644
--- a/src/public/app/services/tab_manager.js
+++ b/src/public/app/services/tab_manager.js
@@ -93,8 +93,6 @@ export default class TabManager extends Component {
filteredTabs[0].active = true;
}
- console.log("filteredTabs", filteredTabs);
-
await this.tabsUpdate.allowUpdateWithoutChange(async () => {
for (const tab of filteredTabs) {
await this.openTabWithNote(tab.notePath, tab.active, tab.tabId, tab.hoistedNoteId);
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index 27f20fe6d0..476a2fbc2a 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -92,13 +92,15 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @method
* @param {string} query
- * @param {SearchContext} [searchContext]
+ * @param {Object} [searchParams]
* @returns {Note[]}
*/
- this.searchForNotes = (query, searchContext) => {
- searchContext = searchContext || new SearchContext();
+ this.searchForNotes = (query, searchParams = {}) => {
+ if (searchParams.includeArchivedNotes === undefined) {
+ searchParams.includeArchivedNotes = true;
+ }
- const noteIds = searchService.findNotesWithQuery(query, searchContext)
+ const noteIds = searchService.findNotesWithQuery(query, new SearchContext(searchParams))
.map(sr => sr.noteId);
return repository.getNotes(noteIds);
diff --git a/src/services/sync.js b/src/services/sync.js
index 817b29a292..a03db6d9c2 100644
--- a/src/services/sync.js
+++ b/src/services/sync.js
@@ -320,6 +320,12 @@ function getEntityChangesRecords(entityChanges) {
let length = 0;
for (const entityChange of entityChanges) {
+ if (entityChange.isErased) {
+ records.push({entityChange});
+
+ continue;
+ }
+
const entity = getEntityChangeRow(entityChange.entityName, entityChange.entityId);
if (entityChange.entityName === 'options' && !entity.isSynced) {