file: search operator could be better optimized to reduce gitserver IO load
Created by: slimsag
Steps to reproduce:
- Be on a Sourcegraph instance with a large number of repositories.
- Ensure the Sourcegraph instance has a high
maxReposToSearch
value (i.e. any large Sourcegraph instance). - In the search field, type just
file:a
, then quickly in succession hit backspace to erasea
and typeb
, thenc
, and so on. - You will notice the search suggestions rapidly getting slower. Press enter after a while (e.g. after reaching
file:h
in the alphabet). - Enter a search query like
file:h error
which will turn up results. The results will quickly appear, but the code inside of them will take a LONG time to load:
Gitserver logs will indicate:
WARN Long exec request [...]