Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"More" link for facets that shows _facet_size=max results #1337

Closed
simonw opened this issue May 23, 2021 · 7 comments
Closed

"More" link for facets that shows _facet_size=max results #1337

simonw opened this issue May 23, 2021 · 7 comments

Comments

@simonw
Copy link
Owner

simonw commented May 23, 2021

Original title: "More" link for facets that shows the full set of results

The simplest way to do this will be to have it link to a generated SQL query.

Originally posted by @simonw in #1332 (comment)

@simonw
Copy link
Owner Author

simonw commented May 23, 2021

The tricky thing about this is that ideally I'd like this to link to a paginated set of results - but arbitrary SQL queries do not yet support pagination, see #856.

@simonw
Copy link
Owner Author

simonw commented May 27, 2021

Here's a much easier way to implement this: implement ?_facet_size=max (sets it to max_returned_rows, default 1000) and then link to that from the ellipsis.

@simonw
Copy link
Owner Author

simonw commented May 27, 2021

In order to cleanly implement this I need to expose the path_with_replaced_args utility function to Datasette's template engine. This is the first time this will become an exposed (and hence should-by-documented) API and I don't like its shape much.

@simonw
Copy link
Owner Author

simonw commented May 27, 2021

Turns out path_with_replaced_args() is already exposed to the table.html template context:

"is_sortable": any(c["sortable"] for c in display_columns),
"path_with_replaced_args": path_with_replaced_args,
"path_with_removed_args": path_with_removed_args,
"append_querystring": append_querystring,

@simonw simonw changed the title "More" link for facets that shows the full set of results "More" link for facets that shows _facet_size=max results May 27, 2021
@simonw simonw closed this as completed in 7e983fe May 27, 2021
@simonw
Copy link
Owner Author

simonw commented May 27, 2021

@simonw
Copy link
Owner Author

simonw commented May 27, 2021

Here's a demo showing that once you get above 1,000 results you still get the "..." but it no longer links to anything: https://fivethirtyeight.datasettes.com/fivethirtyeight/births%2FUS_births_2000-2014_SSA?_facet=births&_facet_size=max

simonw added a commit that referenced this issue May 27, 2021
simonw added a commit that referenced this issue Jun 5, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant