Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search backend: simplify repo:contains resolution #40280

Merged
merged 2 commits into from
Aug 12, 2022

Conversation

camdencheek
Copy link
Member

@camdencheek camdencheek commented Aug 11, 2022

I think I figured out the right way to use Zoekt's Type and List() queries, which simplifies the repo:contains... resolution during repo resolution. This change is also required for correct behavior of the negated form of the predicate (which is in the works).

Stacked on #40239

Test plan

Integration tests, manual testing, pulled this off another larger change that I've been testing more extensively.

@cla-bot cla-bot bot added the cla-signed label Aug 11, 2022
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Aug 11, 2022

Codenotify: Notifying subscribers in CODENOTIFY files for diff 57bf297...1e478e5.

Notify File(s)
@beyang internal/search/repos/repos.go
internal/search/repos/repos_test.go
internal/search/zoekt/query.go
@keegancsmith internal/search/repos/repos.go
internal/search/repos/repos_test.go
internal/search/zoekt/query.go

@camdencheek camdencheek changed the base branch from main to backend-integration/cc/global-contains August 11, 2022 19:45
@camdencheek camdencheek added the team/search-product Issues owned by the search product team label Aug 11, 2022
@camdencheek camdencheek requested a review from a team August 11, 2022 20:38
and = append(and, &zoekt.Type{Type: zoekt.TypeRepo, Child: zoekt.NewAnd(repoHasFilters...)})
and = append(and, zoekt.NewAnd(repoHasFilters...))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QueryForFileContentArgs now returns a zoekt.Type query, so we don't need to wrap here anymore

@@ -586,25 +585,23 @@ func (r *Resolver) filterRepoHasFileContent(
q := searchzoekt.QueryForFileContentArgs(opt, op.CaseSensitiveRepoFilters)
q = zoektquery.NewAnd(&zoektquery.BranchesRepos{List: indexed.BranchRepos()}, q)

repos, err := r.zoekt.List(ctx, q, &zoekt.ListOptions{Minimal: true})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Becuase QueryForFileContentArgs now returns a zoekt.Type{} query, the query will only ever return repos and it will work with zoekt.List().

Copy link
Contributor

@rvantonder rvantonder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@camdencheek camdencheek force-pushed the backend-integration/cc/global-contains branch from 25596b0 to f062cde Compare August 12, 2022 19:59
Base automatically changed from backend-integration/cc/global-contains to main August 12, 2022 20:16
@camdencheek camdencheek force-pushed the backend-integration/cc/simplify-list branch from 98a876c to 1e478e5 Compare August 12, 2022 20:33
@camdencheek camdencheek enabled auto-merge (squash) August 12, 2022 20:38
@camdencheek camdencheek merged commit c8a6030 into main Aug 12, 2022
@camdencheek camdencheek deleted the backend-integration/cc/simplify-list branch August 12, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed team/search-product Issues owned by the search product team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants