lib/search/word: fix english sql query
This commit is contained in:
@@ -133,13 +133,22 @@ Future<List<ScoredEntryId>> fetchEntryIds(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SearchMode.English:
|
case SearchMode.English:
|
||||||
entryIds = (await connection.query(
|
entryIds = (await connection.rawQuery(
|
||||||
JMdictTableNames.senseGlossary,
|
'''
|
||||||
columns: ['entryId'],
|
SELECT DISTINCT
|
||||||
where: 'english LIKE ?',
|
"${JMdictTableNames.sense}"."entryId"
|
||||||
whereArgs: ['%$word%'],
|
FROM "${JMdictTableNames.senseGlossary}"
|
||||||
limit: pageSize,
|
JOIN "${JMdictTableNames.sense}" USING ("senseId")
|
||||||
offset: offset,
|
WHERE "${JMdictTableNames.senseGlossary}"."phrase" LIKE ?
|
||||||
|
LIMIT ?
|
||||||
|
OFFSET ?
|
||||||
|
'''
|
||||||
|
.trim(),
|
||||||
|
[
|
||||||
|
'%$word%',
|
||||||
|
pageSize,
|
||||||
|
offset,
|
||||||
|
],
|
||||||
))
|
))
|
||||||
.map((row) => ScoredEntryId(
|
.map((row) => ScoredEntryId(
|
||||||
row['entryId'] as int,
|
row['entryId'] as int,
|
||||||
@@ -200,13 +209,19 @@ Future<int?> fetchEntryIdCount(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SearchMode.English:
|
case SearchMode.English:
|
||||||
entryIdCount = (await connection.query(
|
entryIdCount = (await connection.rawQuery(
|
||||||
JMdictTableNames.senseGlossary,
|
'''
|
||||||
columns: ['COUNT(DISTINCT entryId)'],
|
SELECT COUNT(DISTINCT "${JMdictTableNames.sense}"."entryId") AS "count"
|
||||||
where: 'english LIKE ?',
|
FROM "${JMdictTableNames.senseGlossary}"
|
||||||
whereArgs: ['%$word%'],
|
JOIN "${JMdictTableNames.sense}" USING ("senseId")
|
||||||
|
WHERE "${JMdictTableNames.senseGlossary}"."phrase" LIKE ?
|
||||||
|
'''
|
||||||
|
.trim(),
|
||||||
|
[
|
||||||
|
'%$word%',
|
||||||
|
],
|
||||||
))
|
))
|
||||||
.firstOrNull?['COUNT(DISTINCT entryId)'] as int?;
|
.firstOrNull?['count'] as int?;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SearchMode.MixedKana:
|
case SearchMode.MixedKana:
|
||||||
|
|||||||
Reference in New Issue
Block a user