global search: do not return trashed items

This commit is contained in:
Thibault Deckers 2022-02-24 18:12:23 +09:00
parent fc1234ca63
commit 529bd6b0e4
3 changed files with 5 additions and 5 deletions

View file

@ -30,7 +30,7 @@ abstract class MetadataDb {
Future<void> updateEntry(int id, AvesEntry entry);
Future<Set<AvesEntry>> searchEntries(String query, {int? limit});
Future<Set<AvesEntry>> searchLiveEntries(String query, {int? limit});
// date taken

View file

@ -215,11 +215,11 @@ class SqfliteMetadataDb implements MetadataDb {
}
@override
Future<Set<AvesEntry>> searchEntries(String query, {int? limit}) async {
Future<Set<AvesEntry>> searchLiveEntries(String query, {int? limit}) async {
final rows = await _db.query(
entryTable,
where: 'title LIKE ?',
whereArgs: ['%$query%'],
where: 'title LIKE ? AND trashed = ?',
whereArgs: ['%$query%', 0],
orderBy: 'sourceDateTakenMillis DESC',
limit: limit,
);

View file

@ -51,7 +51,7 @@ Future<List<Map<String, String?>>> _getSuggestions(dynamic args) async {
debugPrint('getSuggestions query=$query, locale=$locale use24hour=$use24hour');
if (query is String && locale is String) {
final entries = await metadataDb.searchEntries(query, limit: 9);
final entries = await metadataDb.searchLiveEntries(query, limit: 9);
suggestions.addAll(entries.map((entry) {
final date = entry.bestDate;
return {