Filter out user repositories and forks when searching code

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem to solve

It is difficult to search for code when:

  1. You need a global search (not just one specific group)
  2. User repositories and/or forks of upstream repositories clutter the results

Intended users

Developers

Further details

When using a self-hosted GitLab instance, code is often distributed across a number of different GitLab groups. If the engineer's workflow involves forking the repository, searching code proves impractical, because user forks are mixed in with the rest of the results. It would be useful to be able to filter results to remove forks and/or user repositories when searching code. This may also apply to other search patterns (gitlab-ce#30771).

An example I find myself regularly encountering is searching across all repositories for upstream repositories that have a .gitlab-ci.yml that contains a particular runner tag.

Proposal

Add Syntax to allow the ability to filter out:

  • Forks
  • User repositories

Permissions and Security

I don't think this has permissions or security implications.

Documentation

I'm not sure if I'm supposed to do this? If so let me know.

Testing

This could require changes to the elastic search schema, which would require testing.

What does success look like, and how can we measure that?

I can easily only search the contents of "groups" in GitLab, and I can easily search all of GitLab, but ignore forks.

Links / references

Relates to gitlab-ce#30771

Edited by 🤖 GitLab Bot 🤖