search: shortcircuit on count for search expressions
Created by: rvantonder
After merging #13907, my nice big queries for blog post became slow, because no shortcircuiting was happening (it's as if count:30
was specified for each or
subexpression, and always run). This PR:
- shortcircuits on subexpression results once we've hit 'enough' results (30 by default).
- additionally, #13907 invalidates resolved repos for every
or
subexpression. This is overkill: we only need to invalidate the repo cache if there are more than onerepo
orrepogroup
field.
For now it just matters that the search integration tests are green, so that I can publish the blog post: https://buildkite.com/sourcegraph/sourcegraph/builds/76866. I will follow up with an integration test that checks shortcircuiting is honored as expected--this needs some more significant changes to gqltest
.