I am currently facing issues with the GitHub Search API where the number of search results significantly differs from what I see on the GitHub web app. I would like to understand these discrepancies and find a solution.
ISSUE 1 ⚠️ Discrepancy in Search Results Count
Question❓ Why there’s a large discrepancy between the API and web interface results?
Query Used:
"new(params[" OR "create(params[" OR "update_attributes(params[" path:app/controllers language:Ruby
URL: https://github.com/search?q=%22new%28params%5B%22+OR+%22create%28params%5B%22+OR+%22update_attributes%28params%5B%22+path%3Aapp%2Fcontrollers+language%3ARuby&type=code&p=1
Expected Behavior:
When I run this search query on the GitHub website, it shows approximately 123k results.And it should also show same results for Github code search API.
Actual Behavior:
Using the same query with the GitHub Search API returns only 225 results.
Additional Attempts:
- I have tried encoding the query parameters too.
- Here are the headers I am using: Authorization: Bearer token (Used GitHub personal access token), Accept: application/vnd.github.v3+json, X-GitHub-Api-Version: 2022-11-28.
Tried passing query parameters like these too:
- https://api.github.com/search/code?q=”new(params[” OR “create(params[” OR “update_attributes(params[” path:app/controllers language:Ruby&per_page=100
- https://api.github.com/search/code?q=%22new%28params%5B%22%20OR%20%22create%28params%5B%22%20OR%20%22update_attributes%28params%5B%22%20path%3Aapp/controllers%20language%3ARuby&per_page=100
- https://api.github.com/search/code?q=”new%28params%5B”+OR+”create%28params%5B”+OR+”update_attributes%28params%5B”+path%3Aapp%2Fcontrollers+language%3ARuby&per_page=100
- https://api.github.com/search/code?q=%22new%28params%5B%22+OR+%22create%28params%5B%22+OR+%22update_attributes%28params%5B%22+path%3Aapp%2Fcontrollers+language%3ARuby&per_page=100
ISSUE 2 ⚠️ Navigation Limit on GitHub Web Interface
Question❓ Is there a limitation on how many pages or results one can navigate through on the GitHub website? If so, then why?
Description:
While the GitHub web interface initially shows 123k files for the above query, it does not allow navigating beyond the 5th page of results.
Expected Behavior:
When I run this search query on the GitHub website, it shows approximately 123k results.And it should also show same results for @Github code search API.
abdulmoizhmed is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.