You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
API: Resolves #1148: Added support for search end-point and improved error handling
This commit is contained in:
@ -3,15 +3,17 @@ const Note = require('lib/models/Note');
|
||||
|
||||
class SearchEngineUtils {
|
||||
|
||||
static async notesForQuery(query) {
|
||||
static async notesForQuery(query, options = null) {
|
||||
if (!options) options = {};
|
||||
|
||||
const results = await SearchEngine.instance().search(query);
|
||||
const noteIds = results.map(n => n.id);
|
||||
|
||||
const previewOptions = {
|
||||
const previewOptions = Object.assign({}, {
|
||||
order: [],
|
||||
fields: Note.previewFields(),
|
||||
conditions: ['id IN ("' + noteIds.join('","') + '")'],
|
||||
}
|
||||
}, options);
|
||||
|
||||
const notes = await Note.previews(null, previewOptions);
|
||||
|
||||
|
Reference in New Issue
Block a user