Gitlab search in code returns no results if search term is a word longer than 40 characters
Problem to Solve
Currently GitLab search is unable to return results if the search term is longer than 40 characters.
Proposal
We should truncate the search term in the search query if the term is longer than 40 characters. This will allow the search to work and still retrieve some results which may be relevant to the original search term.
Documentation
We should update the documentation for Advanced Global Search appropriately to reflect that search terms are limited to 40 characters and automatically truncated if more than 40 characters are provided.
Original Description
Summary
Searching a long search (above 40 characters with no spaces) term in all projects will always yield no results, even if that phrase exists
Steps to reproduce
Find a long (above 40 characters) continuous (no spaces) phrase that exists in one of the projects hosted in your gitlab, and search for it. It should appear in the results, but it doesn't.
Example Project
Not possible, I'm using EE in my place of work. All projects are private.
What is the current bug behavior?
gitlab shows no result when searching for a term that exists.
What is the expected correct behavior?
gitlab should either:
- find the result
- show a warning saying that the search term is longer than the maximum length of indexed terms
- truncate to 40 (or current max-ngram), then search
Also: give the option to change the max-ngram for gitlab's elasticsearch index
notes
- it is very important to at least show why results were not found. If I'm searching to see if something is being referenced somewhere to know if I can safely delete it, I am expecting that a "No results found" would mean I can safely delete it. This is very misleading and could lead to potentials problems
Relevant logs and/or screenshots
Cannot share screenshots from company's private gitlab
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)