The way predicates currently work, they require that we execute them with a large count value to ensure that we are not missing valid results.
Consider repo:contains.commit.after(1 year ago) file:super_rare_file.go count:1
First, repo:contains.commit.after(1 year ago) is expanded to a list of repo names using the query repohascommitafter:"1 year ago" select:repo count:99999. If we don't add that extra count parameter, we may not return the only repo that contains super_rare_file.go, and our original search may return no results.
However, if there are many repos that have new commits, we may be doing significantly more work than if we'd inverted the search to something like repo:contains(file:super_rare_file.go) repohascommitafter:"1 year ago" count:1. By filtering to our rare predicate first, we drastically reduce the amount of work that is done.
Somehow, we should figure out a way to smartly limit the number of results for predicates. One way of doing this would be to retry with a higher count if we didn't hit our outer limit.
The way predicates currently work, they require that we execute them with a large
countvalue to ensure that we are not missing valid results.Consider
repo:contains.commit.after(1 year ago) file:super_rare_file.go count:1First,
repo:contains.commit.after(1 year ago)is expanded to a list of repo names using the queryrepohascommitafter:"1 year ago" select:repo count:99999. If we don't add that extracountparameter, we may not return the only repo that containssuper_rare_file.go, and our original search may return no results.However, if there are many repos that have new commits, we may be doing significantly more work than if we'd inverted the search to something like
repo:contains(file:super_rare_file.go) repohascommitafter:"1 year ago" count:1. By filtering to our rare predicate first, we drastically reduce the amount of work that is done.Somehow, we should figure out a way to smartly limit the number of results for predicates. One way of doing this would be to retry with a higher count if we didn't hit our outer limit.