migrations: add view for base/furigana queries
This commit is contained in:
+24
-36
@@ -99,23 +99,19 @@ Future<List<WordSearchResult>?> searchWordWithDbConnection(
|
||||
JMdict_SenseAntonym.senseId,
|
||||
JMdict_SenseAntonym.ambiguous,
|
||||
JMdict_SenseAntonym.xrefEntryId,
|
||||
JMdict_KanjiElementDistinct.reading AS kanji,
|
||||
JMdict_ReadingElementDistinct.reading AS reading
|
||||
JMdict_BaseAndFurigana.base,
|
||||
JMdict_BaseAndFurigana.furigana
|
||||
FROM JMdict_SenseAntonym
|
||||
LEFT JOIN
|
||||
(SELECT entryId, reading FROM JMdict_KanjiElement GROUP BY entryId HAVING MIN(orderNum))
|
||||
AS JMdict_KanjiElementDistinct
|
||||
ON JMdict_SenseAntonym.xrefEntryId = JMdict_KanjiElementDistinct.entryId
|
||||
LEFT JOIN
|
||||
(SELECT entryId, reading FROM JMdict_ReadingElement GROUP BY entryId HAVING MIN(orderNum))
|
||||
AS JMdict_ReadingElementDistinct
|
||||
ON JMdict_SenseAntonym.xrefEntryId = JMdict_ReadingElementDistinct.entryId
|
||||
WHERE senseId IN (${senseIds.join(',')})
|
||||
JOIN "JMdict_BaseAndFurigana"
|
||||
ON JMdict_SenseAntonym.xrefEntryId = JMdict_BaseAndFurigana.entryId
|
||||
WHERE
|
||||
senseId IN (${senseIds.join(',')})
|
||||
AND COALESCE("JMdict_BaseAndFurigana"."kanjiOrderNum", 1)
|
||||
+ "JMdict_BaseAndFurigana"."readingOrderNum"
|
||||
= 2
|
||||
ORDER BY
|
||||
JMdict_SenseAntonym.senseId,
|
||||
JMdict_SenseAntonym.xrefEntryId,
|
||||
JMdict_KanjiElementDistinct.reading,
|
||||
JMdict_ReadingElementDistinct.reading
|
||||
JMdict_SenseAntonym.xrefEntryId
|
||||
""");
|
||||
|
||||
late final List<Map<String, Object?>> senseDialects;
|
||||
@@ -184,23 +180,19 @@ Future<List<WordSearchResult>?> searchWordWithDbConnection(
|
||||
JMdict_SenseSeeAlso.senseId,
|
||||
JMdict_SenseSeeAlso.ambiguous,
|
||||
JMdict_SenseSeeAlso.xrefEntryId,
|
||||
JMdict_KanjiElementDistinct.reading AS kanji,
|
||||
JMdict_ReadingElementDistinct.reading AS reading
|
||||
JMdict_BaseAndFurigana.base,
|
||||
JMdict_BaseAndFurigana.furigana
|
||||
FROM JMdict_SenseSeeAlso
|
||||
LEFT JOIN
|
||||
(SELECT entryId, reading FROM JMdict_KanjiElement GROUP BY entryId HAVING MIN(orderNum))
|
||||
AS JMdict_KanjiElementDistinct
|
||||
ON JMdict_SenseSeeAlso.xrefEntryId = JMdict_KanjiElementDistinct.entryId
|
||||
LEFT JOIN
|
||||
(SELECT entryId, reading FROM JMdict_ReadingElement GROUP BY entryId HAVING MIN(orderNum))
|
||||
AS JMdict_ReadingElementDistinct
|
||||
ON JMdict_SenseSeeAlso.xrefEntryId = JMdict_ReadingElementDistinct.entryId
|
||||
WHERE senseId IN (${senseIds.join(',')})
|
||||
JOIN "JMdict_BaseAndFurigana"
|
||||
ON JMdict_SenseSeeAlso.xrefEntryId = JMdict_BaseAndFurigana.entryId
|
||||
WHERE
|
||||
senseId IN (${senseIds.join(',')})
|
||||
AND COALESCE("JMdict_BaseAndFurigana"."kanjiOrderNum", 1)
|
||||
+ "JMdict_BaseAndFurigana"."readingOrderNum"
|
||||
= 2
|
||||
ORDER BY
|
||||
JMdict_SenseSeeAlso.senseId,
|
||||
JMdict_SenseSeeAlso.xrefEntryId,
|
||||
JMdict_KanjiElementDistinct.reading,
|
||||
JMdict_ReadingElementDistinct.reading
|
||||
JMdict_SenseSeeAlso.xrefEntryId
|
||||
""");
|
||||
|
||||
late final List<Map<String, Object?>> exampleSentences;
|
||||
@@ -531,20 +523,16 @@ List<WordSearchSense> _regroup_senses({
|
||||
seeAlso: seeAlsos
|
||||
.map((e) => WordSearchXrefEntry(
|
||||
entryId: e['xrefEntryId'] as int,
|
||||
baseWord: (e['kanji'] ?? e['reading']) as String,
|
||||
furigana: (e['kanji'] != null) ?
|
||||
(e['reading'] as String) :
|
||||
null,
|
||||
baseWord: e['base'] as String,
|
||||
furigana: e['furigana'] as String?,
|
||||
ambiguous: e['ambiguous'] == 1,
|
||||
))
|
||||
.toList(),
|
||||
antonyms: antonyms
|
||||
.map((e) => WordSearchXrefEntry(
|
||||
entryId: e['xrefEntryId'] as int,
|
||||
baseWord: (e['kanji'] ?? e['reading']) as String,
|
||||
furigana: (e['kanji'] != null) ?
|
||||
(e['reading'] as String) :
|
||||
null,
|
||||
baseWord: e['base'] as String,
|
||||
furigana: e['furigana'] as String?,
|
||||
ambiguous: e['ambiguous'] == 1,
|
||||
))
|
||||
.toList(),
|
||||
|
||||
Reference in New Issue
Block a user