mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
CLI: Fixes #1096: Fixed search function in terminal app
This commit is contained in:
parent
7c3e8547de
commit
6989f9fd16
@ -41,6 +41,7 @@ class Command extends BaseCommand {
|
||||
title: pattern,
|
||||
query_pattern: pattern,
|
||||
query_folder_id: folder ? folder.id : '',
|
||||
basic_search: true,
|
||||
type_: BaseModel.TYPE_SEARCH,
|
||||
},
|
||||
});
|
||||
|
@ -220,7 +220,23 @@ class BaseApplication {
|
||||
notes = await Tag.notes(parentId, options);
|
||||
} else if (parentType === BaseModel.TYPE_SEARCH) {
|
||||
const search = BaseModel.byId(state.searches, parentId);
|
||||
notes = await SearchEngineUtils.notesForQuery(search.query_pattern);
|
||||
|
||||
if (search.basic_search) {
|
||||
// NOTE: Copied and pasted from ReactNativeClient/lib/components/screens/search.js
|
||||
let p = search.query_pattern.split(' ');
|
||||
let temp = [];
|
||||
for (let i = 0; i < p.length; i++) {
|
||||
let t = p[i].trim();
|
||||
if (!t) continue;
|
||||
temp.push(t);
|
||||
}
|
||||
|
||||
notes = await Note.previews(null, {
|
||||
anywherePattern: '*' + temp.join('*') + '*',
|
||||
});
|
||||
} else {
|
||||
notes = await SearchEngineUtils.notesForQuery(search.query_pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user