Properly format search result counts

Summary

Follow-up from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14689/diffs#note_201138388 / https://gitlab.com/gitlab-org/gitlab-ee/issues/12547

For searches using the DB the queries are limited to 1001 results and displayed as 1000+.

For searches using Gitaly (blobs/commits) and Elasticsearch (anything except users) we don't limit the queries but display the raw number, which doesn't look nice and takes up unnecessary space:

image

Proposal

Format the numbers using e.g. K/M/B units for thousands/millions/billions:

image

Considerations

  • Should we use decimal numbers for millions/billions?
  • Do we need to localize the units?

Involved components

  • Gitlab::SearchResults#formatted_count
  • Gitlab::Elastic::SearchResults#formatted_count
Edited Sep 02, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading