Skip to content

Global Search - Limited and Delimited Tab Counts

Zack Cuddy requested to merge 339279-format-results-tab into master

What does this MR do?

Closes #339279 (closed)
Closes #336475 (closed)

This change adds a Limit and Delimit to our Search Tab Counts. In Global Search there are two types of search:

  1. Basic Search
  2. Elastic Search

Important: Currently, in Basic Search the tab count limit is 100. So if you search results exceed 100, the tab will say 99+. This logic not changing.

This change is focused solely on Elastic Search. In Elastic Search we have a Tab Count limit of 10,000 records. This means that we have numbers that both could need a delimiter (ex. ",") as well as a + sign if we exceed the limit.

To solve this, I created a helper method to receive a number and format it as we would like and then wrapped our count methods with it.

Screenshots or Screencasts (strongly suggested)

Basic Search

Before After
Under 100 Basic_-_Under_100 No change
Over 100 Basic_-_Over_100 No change

Elastic Search

Before After
Under 1k Before_-_Elastic_Under_1k After_-_Elatstic_Under_1k
Over 1k Before_-_Elastic_Over_1k After_-_Elastic_Over_1k
At/Over 10k Before_-_Easltic_Over_10k After_-_Elastic_Over_10k

How to setup and validate locally (strongly suggested)

Standard Test

  1. Setup your GDK with Elastic Search - Docs
  2. Fetch and checkout this branch
  3. Navigate to the search page (ex. http://127.0.0.1:3000/search)
  4. Search for a popular Issue title (ex. Voluptas)
  5. Ensure results render correctly

Large Count Tests

This can be a bit challenging to get large numbers in the GDK quickly, I will provide a patch to "spoof" this. For a more technical reviewer simply change the counts passed in the formatted_count method in ee/lib/gitlab/search_results.rb

  1. Download the patch 10k_issues_patch.txt
  2. Copy the entire file contents from the patch you downloaded in step 1
  3. Run the command pbpaste | git apply from your /gitlab directory - This should add some local code changes
  4. Navigate to the search page (ex. http://127.0.0.1:3000/search) and search something
  5. Ensure the Issues Tab says 10,000+

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #339279 (closed) and #336475 (closed)

Edited by Zack Cuddy

Merge request reports

Loading