Repro:
https://api.github.com/search/code?q=prometheus+repo:microsoft/fabrikate-definitions+language:yaml
Seen: list of results
client.Search.Code(ctx, "prometheus+language:yaml+repo:microsoft/fabrikate-definitions", nil)
This results in an encoded query string https://api.github.com/search/code?q=prometheus%2Brepo%3Amicrosoft%2Ffabrikate-definitions%2Blanguage%3Ayaml
Expected: The same list of results as step 1
Seen: Validation error
{
"message": "Validation Failed",
"errors": [
{
"message": "Must include at least one user, organization, or repository",
"resource": "Search",
"field": "q",
"code": "invalid"
}
],
"documentation_url": "https://developer.github.com/v3/search/"
}
Thank you, @edaena!
Here is the code responsible for encoding the query string:
https://github.com/google/go-github/blob/master/github/search.go#L217-L231
And here are the unit tests that go with this section of code:
https://github.com/google/go-github/blob/master/github/search_test.go
It looks like the Query parameter as in &searchParameters{Query: query} is not tested, which is unfortunate.
Possibly-related issues are: #963, #966, and #1122.
We should add unit tests for a variety of searches.
For anyone who wants to take up this issue, this will require a good amount of experimentation with the GitHub web interface by performing searches on the website and then performing the same search with this repo, and making sure that the query strings match (and therefore the search results match). This person should also carefully read the history of this issue and the linked issues above and make sure that all the queries from the past still work, including the one listed above by @edaena.
This would be a great PR for any new contributor to this repo or a new Go developer.
All contributions are greatly appreciated!
Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work.
Please check out our CONTRIBUTING.md guide to get started.
Thank you!
Hi - could I help with this issue ? Could you assign me - thanks !
I can't assign it to you, but consider this issue yours, and please read again carefully what I wrote above before writing your PR, as we would like to heavily test a number of search queries and make sure they match queries performed in the GitHub web UI.
Thank you, @jmidd!
any progress on this issue?
i noticed the comment in the search code: https://github.com/google/go-github/blob/a01ea50f2fc0ce93dad509f31ed1b279cc07b424/github/search.go#L220-L221
using instead of + to seems to fix the problem.
Perhaps the solution is to document this better in the docs? figuring out if the + is part of a parameter or a separator is a pretty hard problem imho.
@gmlewis @jmidd @edaena
@henrikrudstrom - do you want to volunteer to improve the documentation?
@jmidd - is that OK with you, or are you still working on this issue?
I will bring this comment to documentation
@gmlewis this issue can be closed
Closing.
Most helpful comment
Hi - could I help with this issue ? Could you assign me - thanks !