{"html_url": "https://github.com/simonw/datasette/issues/359#issuecomment-412356537", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/359", "id": 412356537, "node_id": "MDEyOklzc3VlQ29tbWVudDQxMjM1NjUzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-08-12T17:01:21Z", "updated_at": "2018-08-12T17:01:39Z", "author_association": "OWNER", "body": "Example table: https://latest-code.datasette.io/code/definitions\r\n\r\nHere's a query that does facet counting against that column:\r\n\r\nhttps://latest-code.datasette.io/code-a26fa3c?sql=select+count%28*%29+as+n%2C+j.value+from+definitions+join+json_each%28params%29+j+group+by+j.value+order+by+n+desc%3B\r\n\r\n```\r\nselect count(*) as n, j.value\r\nfrom definitions join json_each(params) j\r\ngroup by j.value order by n desc;\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 349827640, "label": "Faceted browse against a JSON list of tags"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/359#issuecomment-412356746", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/359", "id": 412356746, "node_id": "MDEyOklzc3VlQ29tbWVudDQxMjM1Njc0Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-08-12T17:05:00Z", "updated_at": "2018-08-12T17:05:00Z", "author_association": "OWNER", "body": "And here's the query for pulling back every record tagged with a specific tag:\r\n\r\nhttps://latest-code.datasette.io/code-a26fa3c?sql=select+*+from+definitions+where+rowid+in+%28%0D%0A++select+definitions.rowid%0D%0A++from+definitions+join+json_each%28params%29+j%0D%0A++where+j.value+%3D+%3Atag%0D%0A%29&tag=filename\r\n\r\n```\r\nselect * from definitions where rowid in (\r\n select definitions.rowid\r\n from definitions join json_each(params) j\r\n where j.value = :tag\r\n)\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 349827640, "label": "Faceted browse against a JSON list of tags"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/359#issuecomment-412357691", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/359", "id": 412357691, "node_id": "MDEyOklzc3VlQ29tbWVudDQxMjM1NzY5MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-08-12T17:17:29Z", "updated_at": "2018-08-12T17:17:29Z", "author_association": "OWNER", "body": "Note that there doesn't seem to be a way to use indexes (even [indexes on expressions](https://www.sqlite.org/expridx.html)) to speed these up, so this will only ever be effective on smaller data sets, probably in the 10,000-100,000 range. Datasette is often used with smaller data sets so this is still worth pursuing.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 349827640, "label": "Faceted browse against a JSON list of tags"}, "performed_via_github_app": null}