Fixed duplicate tags.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4364 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-07-26 23:56:40 +00:00
parent b984811851
commit 9239441d73

View File

@ -268,8 +268,9 @@ class TfElement extends LitElement {
recent_mentions AS (SELECT recent.id, json_extract(mention.value, '$.link') AS tag recent_mentions AS (SELECT recent.id, json_extract(mention.value, '$.link') AS tag
FROM recent, json_each(recent.content, '$.mentions') AS mention FROM recent, json_each(recent.content, '$.mentions') AS mention
WHERE json_valid(mention.value) AND tag LIKE '#%'), WHERE json_valid(mention.value) AND tag LIKE '#%'),
combined AS (SELECT id, tag FROM recent_channels UNION ALL SELECT id, tag FROM recent_mentions) combined AS (SELECT id, tag FROM recent_channels UNION ALL SELECT id, tag FROM recent_mentions),
SELECT tag, COUNT(*) AS count FROM combined GROUP BY id, tag ORDER BY count DESC LIMIT 10 by_message AS (SELECT DISTINCT id, tag FROM combined)
SELECT tag, COUNT(*) AS count FROM by_message GROUP BY tag ORDER BY count DESC LIMIT 10
`, [new Date() - 7 * 24 * 60 * 60 * 1000]); `, [new Date() - 7 * 24 * 60 * 60 * 1000]);
console.log('tags took', (new Date() - start) / 1000.0, 'seconds'); console.log('tags took', (new Date() - start) / 1000.0, 'seconds');
} }