Open chwarwick opened 2 years ago
Heads up @joelkw @felixfbecker @vovakulikov @unclejustin - the "team/code-insights" label was applied to this issue.
cc @coury-clark
Additional context, search via the UI provides the expected results, the difference I see is that the query passed to the api is:
context:global .Command or .GitCommand file:vcs/git -file:_test.go lang:go
This moves the .Command or .GitCommand
out of the first position and causes it to be interpreted as:
context:global (.Command or .GitCommand) file:vcs/git -file:_test.go lang:go
instead of:
.Command OR (.GitCommand file:vcs/git -file:_test.go lang:go)
We need to check if our manipulation of the tree (fork/archive) is causing this, or if this is otherwise just a bug in the parser. The examples above don't have the fork archive - does that mean this is from a non-manipulated query?
I thought we explicitly don't support AND
/OR
operators, or do we now?
I thought we explicitly don't support
AND
/OR
operators, or do we now?
I think that's only true for capture group insights, since the compute endpoint doesn't support that yet.
The manipulation of the tree doesn't cause it, it's dependent on the what the parser encounters first. If it's a parameter like context, repo, fork, etc...
then it parses the way we expect and matches the search UI, however if it first encounters .Command or .GitCommand
it parses differently.
My initial reaction is it's a bug in the query parsing but I could interpret query
.Command or .GitCommand file:vcs/git -file:_test.go lang:go
As
.Command OR .GitCommand AND file:vcs/git AND -file:_test.go AND lang:go
In which case I think it's correct, and it's the search box that is returning results that I would expect.
@coury-clark
Validate to see if it's a search issue, and if so file an issue with search.
The following search query in an insight results in an incorrect search:
.Command or .GitCommand file:vcs/git -file:_test.go lang:go
Generated the following query:
(archived:no fork:no .Command OR archived:no fork:no file:vcs/git -file:_test.go lang:go .GitCommand)
This search is wrong because the
.Command
side of theor
is not applying the additional file and lang parameters.Work arounds:
(.Command or .GitCommand) file:vcs/git -file:_test.go lang:go
file:vcs/git -file:_test.go lang:go .Command or .GitCommand