Date range support in code search

This query returns hits:

curl -i 'https://api.github.com/search/code?access_token=redacted&q=jaketrent'

But this query does not:

curl -i 'https://api.github.com/search/code?access_token=redacted&q=jaketrent+created:<2018-11-10'

The difference is the addition of the created: filter.

I see this date range filter ability documented, but after seeing this result I’m concerned that this might not work for searching code:

https://help.github.com/articles/understanding-the-search-syntax/#query-for-dates

Can anyone confirm?

And if it’s not possible, are there other ideas on how to return more than the stated 1000 max results in a code search?

Hi @jaketrent,

Thanks for being here! Search will only return a maximum of 1000 results. In order to get all the results, you’ll need to “chunk” your search into manageable pieces. One filter to use for that would be the size filter:

https://help.github.com/articles/searching-for-repositories/#search-by-repository-size.

I hope this helps!

Andrea

Ok, I’m assuming since you’re suggesting chunking by repo size instead of create date that the create date filter indeed does not work in the code search api.  Thank you for you for your additional chunking idea.

Just as a piece of user feedback, the search result set limit of 1000 is lame from my perspective (which admittedly lacks a lot of context on the probable good reasons for this limitation).  Seems like since the result set is paged already we could presume to cycle through all the pages of a search until an entire result set was processed.

Fyi, I am adjusting my solution to list all the repos in an org and then searching each of those repos (n search api hits) vs searching the org (1 search api hit).

1 Like