Skip to content

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

Closed

Description

@simonw

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.

Activity

  1. simonw commented on Aug 6, 2021

    @simonw
    OwnerAuthor

    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.

  2. simonw commented on Aug 6, 2021

    @simonw
    OwnerAuthor

    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>

  3. simonw commented on Aug 6, 2021

    @simonw
    OwnerAuthor

    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.

  4. simonw commented on Aug 6, 2021

    @simonw
    OwnerAuthor

    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.

  5. simonw commented on Aug 6, 2021

    @simonw
    OwnerAuthor

    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.

  6. simonw commented on Aug 16, 2021

    @simonw
    OwnerAuthor

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

  7. added a commit that references this issue on Aug 28, 2021
  8. added a commit that references this issue on Oct 14, 2021
  9. added a commit that references this issue on Oct 24, 2021
  10. plpxsk commented on Dec 14, 2021

    @plpxsk
    Sponsor

    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?

  11. simonw commented on Dec 15, 2021

    @simonw
    OwnerAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions