github / issue-metrics

Gather metrics on issues/prs/discussions such as time to first response, count of issues opened, closed, etc.

Home Page:https://github.blog/2023-07-19-metrics-for-issues-pull-requests-and-discussions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error `The search query is invalid; Check the search query.` with multiple repositories in `SEARCH_QUERY`

nmertaydin opened this issue Β· comments

Hello folks πŸ‘‹

First of all, thanks for this great project, I really appreciate it. ❀️

For some reason, when I have multiple repositories in the SEARCH_QUERY I always get The search query is invalid; Check the search query. error. If I try with one repository at a time, there's no such problem. What could be the issue? How could I triage it?

Here's a sample SEARCH_QUERY captured from a failed instance:

is:pr created:2024-03-07..2024-03-14 -is:draft author:a1 author:a2 author:a3 author:a4 author:a5  repo:org/repo1 repo:org/repo2 repo:org/repo3 repo:org/repo4 repo:org/repo5

And another captured from a successful instance:

is:pr created:2024-03-07..2024-03-14 -is:draft author:a1 author:a2 author:a3 author:a4 author:a5  repo:org/repo1

Any ideas? I'm using a personal access token with proper access rights. πŸ—’οΈ

Thanks in advance. πŸ™‡β€β™‚οΈ

One thing to try would be to check that these search queries also fail/succeed the same when entered into the github search ui as when they are used in this tool. that could help us narrow down if the search syntax is an issue with the backend search API or something specific about this tool.

Hello @zkoppert πŸ‘‹

Thanks for your comment.

I tried using the built search query with the Github UI and strangely it could not search. I mean, there was no error but it didn't make sense, it seems like it isn't able to conduct a search. πŸ˜•

image

When I search with a single repo, the UI is able to show PR results:

repo:org/repo1 is:pr -is:draft

When I add a second repo, the UI shows the message above:

repo:org/repo1  repo:org/repo2 is:pr -is:draft

The message above is indicating that there are no results to show. Maybe it is parsing the search as it has to be in both repos like an "and" function? πŸ€”

I'm not seeing those same results when I test this on a set of open source repos.... In the below examples the proper search results are returned. Do you see that as well?

Check out repo:github/evergreen is:pr -is:draft at this link
and also repo:github/evergreen repo:github/contributors is:pr -is:draft at this link

Hey @zkoppert πŸ‘‹

Thanks for checking it out with open source repos. You're right.

I think I found out what causes this strange behavior with private repositories. Although my user has read access to all repositories, for some reason, I need to be part of the GitHub teams that maintain all repositories (or a root GitHub team that contains all other teams) that I want to conduct multiple-repository-search on. πŸ€·β€β™‚οΈ

I don't really understand the logic behind this because I would have expected a single repo search to return no results as well.

Yeah that is an odd design. I'll close out this issue in this repo since it's related to core search functionality.