diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html
index e62a00c54..fd3b7582f 100644
--- a/docs/backend_api/BackendScriptApi.html
+++ b/docs/backend_api/BackendScriptApi.html
@@ -394,7 +394,7 @@ the backend.
Source:
@@ -758,7 +758,7 @@ the backend.
Source:
@@ -1044,7 +1044,7 @@ the backend.
Source:
@@ -1224,7 +1224,7 @@ the backend.
Source:
@@ -1423,7 +1423,7 @@ the backend.
Source:
@@ -1523,7 +1523,7 @@ the backend.
Source:
@@ -1981,7 +1981,7 @@ the backend.
Source:
@@ -2739,7 +2739,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3084,7 +3084,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3280,7 +3280,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3384,7 +3384,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3560,7 +3560,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3713,7 +3713,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3861,7 +3861,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3891,6 +3891,164 @@ if some action needs to happen on only one specific instance.
+
+
+
+
+ searchForNotes(searchString) → {Promise.<Array.<Note>>}
+
+
+
+
+
+
+
+ This is a powerful search method - you can search by attributes and their values, e.g.:
+"@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ searchString |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+ $
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Promise.<Array.<Note>>
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4073,7 +4231,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
Source:
@@ -4204,7 +4362,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
Source:
@@ -4418,7 +4576,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
Source:
@@ -4575,7 +4733,7 @@ transactional by default.
Source:
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html
index 1a05d7ceb..7289ae598 100644
--- a/docs/backend_api/Note.html
+++ b/docs/backend_api/Note.html
@@ -581,7 +581,7 @@
Source:
@@ -746,7 +746,7 @@
Source:
@@ -922,7 +922,7 @@
Source:
@@ -1026,7 +1026,7 @@
Source:
@@ -1126,7 +1126,7 @@
Source:
@@ -1230,7 +1230,7 @@
Source:
@@ -1334,7 +1334,7 @@
Source:
@@ -1434,7 +1434,7 @@
Source:
@@ -1665,7 +1665,7 @@
Source:
@@ -1861,7 +1861,7 @@
Source:
@@ -2057,7 +2057,7 @@
Source:
@@ -2157,7 +2157,7 @@
Source:
@@ -2306,7 +2306,7 @@
Source:
@@ -2471,7 +2471,7 @@
Source:
@@ -2636,7 +2636,7 @@
Source:
@@ -2789,7 +2789,7 @@
Source:
@@ -2897,7 +2897,7 @@
Source:
@@ -3001,7 +3001,7 @@
Source:
@@ -3201,7 +3201,7 @@
Source:
@@ -3305,7 +3305,7 @@
Source:
@@ -3458,7 +3458,7 @@
Source:
@@ -3623,7 +3623,7 @@
Source:
@@ -3788,7 +3788,7 @@
Source:
@@ -3941,7 +3941,7 @@
Source:
@@ -4097,7 +4097,7 @@
Source:
@@ -4205,7 +4205,7 @@
Source:
@@ -4305,7 +4305,7 @@
Source:
@@ -4413,7 +4413,7 @@
Source:
@@ -4513,7 +4513,7 @@
Source:
@@ -4689,7 +4689,7 @@
Source:
@@ -4793,7 +4793,7 @@
Source:
@@ -4946,7 +4946,7 @@
Source:
@@ -5099,7 +5099,7 @@
Source:
@@ -5208,7 +5208,7 @@ Cache is note instance scoped.
Source:
@@ -5290,7 +5290,7 @@ Cache is note instance scoped.
Source:
@@ -5394,7 +5394,7 @@ Cache is note instance scoped.
Source:
@@ -5498,7 +5498,7 @@ Cache is note instance scoped.
Source:
@@ -5602,7 +5602,7 @@ Cache is note instance scoped.
Source:
@@ -5706,7 +5706,7 @@ Cache is note instance scoped.
Source:
@@ -5810,7 +5810,7 @@ Cache is note instance scoped.
Source:
@@ -6037,7 +6037,7 @@ Cache is note instance scoped.
Source:
@@ -6233,7 +6233,7 @@ Cache is note instance scoped.
Source:
@@ -6429,7 +6429,7 @@ Cache is note instance scoped.
Source:
@@ -6656,7 +6656,7 @@ Cache is note instance scoped.
Source:
@@ -6756,7 +6756,7 @@ Cache is note instance scoped.
Source:
@@ -6856,7 +6856,7 @@ Cache is note instance scoped.
Source:
@@ -7052,7 +7052,7 @@ Cache is note instance scoped.
Source:
@@ -7248,7 +7248,7 @@ Cache is note instance scoped.
Source:
@@ -7506,7 +7506,7 @@ Cache is note instance scoped.
Source:
@@ -7733,7 +7733,7 @@ Cache is note instance scoped.
Source:
@@ -7960,7 +7960,7 @@ Cache is note instance scoped.
Source:
diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html
index 4cf885d3a..bc1207d7d 100644
--- a/docs/backend_api/entities_note.js.html
+++ b/docs/backend_api/entities_note.js.html
@@ -102,7 +102,8 @@ class Note extends Entity {
}
if (this.isStringNote()) {
- this.noteContent.content = this.noteContent.content.toString("UTF-8");
+ this.noteContent.content = this.noteContent.content === null
+ ? "" : this.noteContent.content.toString("UTF-8");
}
}
diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html
index 099e4d910..ad0a5b1e3 100644
--- a/docs/backend_api/global.html
+++ b/docs/backend_api/global.html
@@ -272,7 +272,7 @@
Source:
@@ -558,7 +558,7 @@
Source:
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html
index 5432ef685..528781c7e 100644
--- a/docs/backend_api/services_backend_script_api.js.html
+++ b/docs/backend_api/services_backend_script_api.js.html
@@ -30,7 +30,6 @@
const noteService = require('./notes');
const sql = require('./sql');
const utils = require('./utils');
-const dateUtils = require('./date_utils');
const attributeService = require('./attributes');
const dateNoteService = require('./date_notes');
const treeService = require('./tree');
@@ -41,6 +40,7 @@ const dayjs = require('dayjs');
const cloningService = require('./cloning');
const messagingService = require('./messaging');
const appInfo = require('./app_info');
+const searchService = require('./search');
/**
* This is the main backend API interface for scripts. It's published in the local "api" object.
@@ -121,6 +121,16 @@ function BackendScriptApi(currentNote, apiParams) {
*/
this.getEntities = repository.getEntities;
+ /**
+ * This is a powerful search method - you can search by attributes and their values, e.g.:
+ * "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
+ *
+ * @method
+ * @param {string} searchString
+ * @returns ${Promise<Note[]>}
+ */
+ this.searchForNotes = searchService.searchForNotes;
+
/**
* Retrieves notes with given label name & value
*
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index 54c64d5c6..fd56156e0 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -2,7 +2,6 @@ const log = require('./log');
const noteService = require('./notes');
const sql = require('./sql');
const utils = require('./utils');
-const dateUtils = require('./date_utils');
const attributeService = require('./attributes');
const dateNoteService = require('./date_notes');
const treeService = require('./tree');
@@ -13,6 +12,7 @@ const dayjs = require('dayjs');
const cloningService = require('./cloning');
const messagingService = require('./messaging');
const appInfo = require('./app_info');
+const searchService = require('./search');
/**
* This is the main backend API interface for scripts. It's published in the local "api" object.
@@ -93,6 +93,16 @@ function BackendScriptApi(currentNote, apiParams) {
*/
this.getEntities = repository.getEntities;
+ /**
+ * This is a powerful search method - you can search by attributes and their values, e.g.:
+ * "@dateModified =* MONTH AND @log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
+ *
+ * @method
+ * @param {string} searchString
+ * @returns ${Promise}
+ */
+ this.searchForNotes = searchService.searchForNotes;
+
/**
* Retrieves notes with given label name & value
*