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
Structural search insight always shows 0 for most recent data point #50506
Comments
The issue is that we only pass Zoekt let us know before this logic when we called I have a few solutions in mind and will run them by @camdencheek |
…#51076) Issue: #50506 The issue manifests for a structural search for any revisions specified in the query that have both of the following: 1) the revision is a commit and is the latest commit of an indexed branch in Zoekt 2) the revision is not the branch name indexed in Zoekt (i.e. it is not a revision specified in `experimentalFeatures.search.index.branches`) The following fix works for all cases where the indexed branch to query is `HEAD`. Therefore this will resolve the code insights use case since code insights repo filter does not accept revisions. The fix in this PR is intended to be something we can ship quickly and therefore I hoped to avoid modifying existing logic as much as possible. For this reason we keep the `SearchJob` arguments and logic unchanged but just modify the repo revisions passed in. Note that there is still a remaining issue where if we specify two revisions for our query and both of those revisions match both criteria described above, then we do not have enough information to determine which branch to use since we'll have two branches and neither of them have a map to their latest commit. To resolve this I believe we'd have to modify [`PartitionRepos()`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L177:6) and/or [`IndexedRepoRevs`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L38) which would be a bit more involved so I am planning to spin off to a separate ticket. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> New method has test cases added
…#51076) Issue: #50506 The issue manifests for a structural search for any revisions specified in the query that have both of the following: 1) the revision is a commit and is the latest commit of an indexed branch in Zoekt 2) the revision is not the branch name indexed in Zoekt (i.e. it is not a revision specified in `experimentalFeatures.search.index.branches`) The following fix works for all cases where the indexed branch to query is `HEAD`. Therefore this will resolve the code insights use case since code insights repo filter does not accept revisions. The fix in this PR is intended to be something we can ship quickly and therefore I hoped to avoid modifying existing logic as much as possible. For this reason we keep the `SearchJob` arguments and logic unchanged but just modify the repo revisions passed in. Note that there is still a remaining issue where if we specify two revisions for our query and both of those revisions match both criteria described above, then we do not have enough information to determine which branch to use since we'll have two branches and neither of them have a map to their latest commit. To resolve this I believe we'd have to modify [`PartitionRepos()`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L177:6) and/or [`IndexedRepoRevs`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L38) which would be a bit more involved so I am planning to spin off to a separate ticket. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> New method has test cases added (cherry picked from commit 633c37b)
… Zoekt branches (#51419) Issue: #50506 The issue manifests for a structural search for any revisions specified in the query that have both of the following: 1) the revision is a commit and is the latest commit of an indexed branch in Zoekt 2) the revision is not the branch name indexed in Zoekt (i.e. it is not a revision specified in `experimentalFeatures.search.index.branches`) The following fix works for all cases where the indexed branch to query is `HEAD`. Therefore this will resolve the code insights use case since code insights repo filter does not accept revisions. The fix in this PR is intended to be something we can ship quickly and therefore I hoped to avoid modifying existing logic as much as possible. For this reason we keep the `SearchJob` arguments and logic unchanged but just modify the repo revisions passed in. Note that there is still a remaining issue where if we specify two revisions for our query and both of those revisions match both criteria described above, then we do not have enough information to determine which branch to use since we'll have two branches and neither of them have a map to their latest commit. To resolve this I believe we'd have to modify [`PartitionRepos()`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L177:6) and/or [`IndexedRepoRevs`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L38) which would be a bit more involved so I am planning to spin off to a separate ticket. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> New method has test cases added <br> Backport 633c37b from #51076 Co-authored-by: Gary Lee <105310278+gl-srgr@users.noreply.github.com>
This fix is available as of 5.0.3 |
… (#51076) Issue: sourcegraph/sourcegraph#50506 The issue manifests for a structural search for any revisions specified in the query that have both of the following: 1) the revision is a commit and is the latest commit of an indexed branch in Zoekt 2) the revision is not the branch name indexed in Zoekt (i.e. it is not a revision specified in `experimentalFeatures.search.index.branches`) The following fix works for all cases where the indexed branch to query is `HEAD`. Therefore this will resolve the code insights use case since code insights repo filter does not accept revisions. The fix in this PR is intended to be something we can ship quickly and therefore I hoped to avoid modifying existing logic as much as possible. For this reason we keep the `SearchJob` arguments and logic unchanged but just modify the repo revisions passed in. Note that there is still a remaining issue where if we specify two revisions for our query and both of those revisions match both criteria described above, then we do not have enough information to determine which branch to use since we'll have two branches and neither of them have a map to their latest commit. To resolve this I believe we'd have to modify [`PartitionRepos()`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L177:6) and/or [`IndexedRepoRevs`](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/search/zoekt/indexed_search.go?L38) which would be a bit more involved so I am planning to spin off to a separate ticket. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> New method has test cases added
Steps to reproduce:
lang:Python patternType:structural requests.get(...)
Expected behavior:
It shows the correct number of results.
Actual behavior:
It always shows 0 as the number of results.
For example:
The text was updated successfully, but these errors were encountered: