Enforce a character limit of 2 in autocomplete search
What does this MR do and why?
From Add min char limitation to search autocomplete ... (#403325 - closed):
Enforce the min character limit for resources
autocomplete data since that hits the database and Elasticsearch. The search_autocomplete_opts
method has three filter types (search, generic, and default) which return a variety of data.
- Combine the two character limits used in search params and search abuse detection
- remove
Gitlab::Search::AbuseDetection::MINIMUM_SEARCH_CHARS
- replace use with
Gitlab::Search::Params::MIN_TERM_LENGTH
- change
Gitlab::Search::Params::MIN_TERM_LENGTH
to 2
- remove
- The
resource_results
method should return an empty array if the term length is less than the min (useGitlab::Search::Params::MIN_TERM_LENGTH
)
Screenshots or screen recordings
Before
Now
How to set up and validate locally
- Type 1 character into the search bar and note that nothing is returned for projects, groups, issues and users.
- Type 2 characters into the search bar and note that results are returned for projects, groups, issues and users.
- Type 3 characters into the search bar and note that results are returned for projects, groups, issues and users.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #403325 (closed)
Edited by Madelein van Niekerk