mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-29 19:13:59 +02:00
This commit is contained in:
parent
3000afca49
commit
cb21a91fac
@ -777,18 +777,29 @@ export default class SearchEngine {
|
||||
if (!queryHasFilters) {
|
||||
const toSearch = parsedQuery.allTerms.map(t => t.value).join(' ');
|
||||
|
||||
let itemRows = await this.db().selectAll<ProcessResultsRow>(`
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
user_updated_time,
|
||||
offsets(items_fts) AS offsets,
|
||||
matchinfo(items_fts, 'pcnalx') AS matchinfo,
|
||||
item_id,
|
||||
item_type
|
||||
FROM items_fts
|
||||
WHERE title MATCH ? OR body MATCH ?
|
||||
`, [toSearch, toSearch]);
|
||||
let itemRows: ProcessResultsRow[] = [];
|
||||
|
||||
try {
|
||||
itemRows = await this.db().selectAll<ProcessResultsRow>(`
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
user_updated_time,
|
||||
offsets(items_fts) AS offsets,
|
||||
matchinfo(items_fts, 'pcnalx') AS matchinfo,
|
||||
item_id,
|
||||
item_type
|
||||
FROM items_fts
|
||||
WHERE title MATCH ? OR body MATCH ?
|
||||
`, [toSearch, toSearch]);
|
||||
} catch (error) {
|
||||
// Android <= 25 doesn't support the following syntax:
|
||||
// WHERE title MATCH ? OR body MATCH ?
|
||||
// Thus, we skip resource search on these devices.
|
||||
if (!error.message?.includes?.('unable to use function MATCH in the requested context')) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
const resourcesToNotes = await NoteResource.associatedResourceNotes(itemRows.map(r => r.item_id), { fields: ['note_id', 'parent_id'] });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user