Global Search - Limited and Delimited Tab Counts
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:
- Basic Search
- 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 | No change | |
Over 100 | No change |
Elastic Search
Before | After | |
---|---|---|
Under 1k | ||
Over 1k | ||
At/Over 10k |
How to setup and validate locally (strongly suggested)
Standard Test
- Setup your GDK with Elastic Search - Docs
- Fetch and checkout this branch
- Navigate to the search page (ex.
http://127.0.0.1:3000/search
) - Search for a popular Issue title (ex.
Voluptas
) - 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
- Download the patch 10k_issues_patch.txt
- Copy the entire file contents from the patch you downloaded in step 1
- Run the command
pbpaste | git apply
from your/gitlab
directory - This should add some local code changes - Navigate to the search page (ex.
http://127.0.0.1:3000/search
) and search something - Ensure the Issues Tab says 10,000+
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
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)