-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to display facet counts for many-to-many relationships #356
Comments
Here's the query I'm playing with for facet counts:
|
One question here is how these facets should be defined in the table page query string. #427 started exploring this. For any m2m facet we need to know:
The simplest form of m2m relationship can be automatically derived from just knowing the table. We can support that like so: ?_facet_m2m=tagged This could work automatically if the following constraints turn out to apply:
If any of the above rules don't hold, I think the solution is to have explicit configuration. Per #427 this will likely be done using JSON in the query string. Something like this (would be one line but indented for readability):
Probably also need a way of specifying the outbound column used on both us and other - if the m2m table isn't linking to the foreign keys. I don't yet like the names of the above keys. |
Implemented in d923d84 Documentation here: https://datasette.readthedocs.io/en/latest/facets.html#facet-by-many-to-many Demo here: https://latest.datasette.io/fixtures/roadside_attractions |
I went with a much more simple URL scheme: This can be extended to be more complicated in the future if needed. |
Parent: #354
The text was updated successfully, but these errors were encountered: