Skip to content

Gitlab search in code returns no results if search term is a word longer than 40 characters

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:

  1. find the result
  2. show a warning saying that the search term is longer than the maximum length of indexed terms
  3. 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)