1 Commits

Author SHA1 Message Date
1868c6fb41 word_search: don't throw error on empty results 2025-07-09 14:57:19 +02:00

View File

@@ -77,7 +77,7 @@ String _filterFTSSensitiveCharacters(String word) {
${!countOnly ? 'LIMIT ?' : ''}
)
${countOnly ? 'SELECT COUNT("entryId") AS count' : 'SELECT "entryId", MAX("score") AS "score"'}
SELECT ${countOnly ? 'COUNT("entryId") AS count' : '"entryId", MAX("score") AS "score"'}
FROM (
SELECT * FROM fts_results
UNION
@@ -128,7 +128,7 @@ Future<int> _queryKanjiCount(
);
return connection
.rawQuery(query, args)
.then((result) => result.first['count'] as int);
.then((result) => result.firstOrNull?['count'] as int? ?? 0);
}
Future<List<ScoredEntryId>> _queryKana(
@@ -161,7 +161,7 @@ Future<int> _queryKanaCount(
);
return connection
.rawQuery(query, args)
.then((result) => result.first['count'] as int);
.then((result) => result.firstOrNull?['count'] as int? ?? 0);
}
Future<List<ScoredEntryId>> _queryEnglish(