Improve performance of issue and MR finders used without group/project scope

Summary

Search returns 500. Whoops, something went wrong on our end.

Steps to reproduce

Open this URL https://gitlab.com/search?utf8=%E2%9C%93&search=Project+ID%3A+&group_id=&project_id=13083&search_code=true&repository_ref=master

Example Project

https://gitlab.com/gitlab-org/gitlab-ce

What is the current bug behavior?

Search returns 500

What is the expected correct behavior?

Search should display results

Output of checks

This bug happens on GitLab.com

Edited by Douwe Maan