Skip to content
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

Show count of facet values if ?_facet_size=max #1423

Closed
simonw opened this issue Aug 6, 2021 · 9 comments
Closed

Show count of facet values if ?_facet_size=max #1423

simonw opened this issue Aug 6, 2021 · 9 comments

Comments

@simonw
Copy link
Owner

simonw commented Aug 6, 2021

I sometimes want to get a count of the values in a facet - if it's a facet of US states for example I want to know if all 50 are represented.

Idea: if ?_facet_size=max is present, add a count to the facet heading. So on:

https://latest.datasette.io/fixtures/compound_three_primary_keys?_facet=content&_facet_size=max&_facet=pk1&_facet=pk2#facet-pk2

It could have something like this:

fixtures__compound_three_primary_keys__1_001_rows_and_NY_629_755_•_Untitled-1_—_datasette

Note that the first column shows >1000 - because in that case we've truncated the facet calculation since the maximum allowed returned rows is 1000.

@simonw
Copy link
Owner Author

simonw commented Aug 6, 2021

Problem: on a page which doesn't have quite enough facet values to trigger the display of the "..." link that links to ?_facet_size=max the user would still have to manually count the values - up to 30 by default.

So maybe the count should always be shown, perhaps as a non-bold light colored number?

I could even hide it in a non-discoverable tooltip.

@simonw
Copy link
Owner Author

simonw commented Aug 6, 2021

Could display them always, like this:

fixtures__compound_three_primary_keys__1_001_rows_and_School_enrollment_analysis_Colorado_-_Google_Docs

That's with <span style="font-size: 0.8em;color: #666;">23</span>

@simonw
Copy link
Owner Author

simonw commented Aug 6, 2021

Point of confusion: if only 30 options are shown, but there's a ... at the end, what would the number be? It can't be the total number of facets because we haven't counted them all - but if it's just the number of displayed facets that's like to be confusing.

So the original idea of showing the counts only if _facet_size=max is a good one.

@simonw
Copy link
Owner Author

simonw commented Aug 6, 2021

The invisible tooltip could say "Showing 30 items, more available" (helping save you from counting up to 20 if you know about the secret feature). The numbers could then be fully displayed on the "..." page.

@simonw
Copy link
Owner Author

simonw commented Aug 6, 2021

This means that the counts would be unavailable to users who cannot see tooltips (e.g. mobile users) on pages that did not have any facets that broke the 30 limit and hence displayed that "..." link.

I think I'm OK with that, for the moment. May revisit in the future.

@simonw simonw closed this as completed in adb5b70 Aug 16, 2021
@simonw
Copy link
Owner Author

simonw commented Aug 16, 2021

I didn't bother with the tooltip, just the visible display if ?_facet_size=max.

simonw added a commit that referenced this issue Aug 28, 2021
simonw added a commit that referenced this issue Oct 14, 2021
simonw added a commit that referenced this issue Oct 24, 2021
@plpxsk
Copy link

plpxsk commented Dec 14, 2021

Great feature.

But what is the right way to enable this to show up? Currently, it seems I need to edit the URL to add, in the right place, &_facet_size=max

Is there another (easier) way to enable this feature?

@simonw
Copy link
Owner Author

simonw commented Dec 15, 2021

You've caused me to rethink this feature - I no longer think there's value in only showing these numbers if ?_facet_size=max as opposed to all of the time. New issue coming up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants