0

I'm using the GitHub Code Search API with qualifiers.

For example, this query searches for repositories that contain a Dockerfile in them (and works fine, if you have an API Token

GET https://api.github.com/search/code?q=filename:Dockerfile&page=2
Accept: application/vnd.github+json
Authorization: Bearer {{token}}

Now, there is a limitation of 1k results for a given search, meaning that I won't ever get more than 10 pages of results (even though the API answers that there are over 6044206 results).

So my attempt to go further with this is to filter my request further and add more qualifiers.

So let's do the same, but add a language filter qualifier as well

GET https://api.github.com/search/code?q=filename:Dockerfile language:Python&page=2
Accept: application/vnd.github+json
Authorization: Bearer {{token}}

Thing is, whatever I try I always end up with an empty request when combining qualifiers

{
  "total_count": 1,
  "incomplete_results": false,
  "items": []
}

As you can see only "1" result is found (even though there are definitely many more).

I am confused because I can see qualifiers being combined in the docs themselves :

enter image description here

Actually, when literally entering that search query from the documentation I get the same incorrect answer :

GET https://api.github.com/search/code?q=element language:xml size:100&page=2
Accept: application/vnd.github+json
Authorization: Bearer {{token}}

returns

{
  "total_count": 0,
  "incomplete_results": false,
  "items": []
}

Can anyone point me as to what is happening?

Thanks!

jlengrand
  • 12,152
  • 14
  • 57
  • 87

0 Answers0