diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index d537e838..ee30ffa9 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -268,8 +268,9 @@ class TfElement extends LitElement { recent_mentions AS (SELECT recent.id, json_extract(mention.value, '$.link') AS tag FROM recent, json_each(recent.content, '$.mentions') AS mention WHERE json_valid(mention.value) AND tag LIKE '#%'), - 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 + combined AS (SELECT id, tag FROM recent_channels UNION ALL SELECT id, tag FROM recent_mentions), + 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]); console.log('tags took', (new Date() - start) / 1000.0, 'seconds'); }