-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set both "page" and "page_size" Params to PagedSearchIterable #1144
Comments
I now understand how silly my question was. I didn't notice the Fair warning to folks who are in the same boat - the issue will be masked and you'll be waiting forever if you use similar code to mine as shown below to read the results.
Since each call will exactly fetch the requested page_size, the iterator can be used to fetch the exact number of results you need - hopefully a multiple of page_size. To request records individually - use
Please note that @kohsuke - Please close this issue as invalid or probably add this to the documentation :) |
Thanks for a very thorough bug report, though. |
Describe the bug
While trying to limit filename search results to a specific number - say 1, the library ends up iterating over all the pages until every result is collated. I was trying to limit my search result to only one page with a certain page_size. Not looking for the library to parse all possible pages.
To Reproduce
Steps to reproduce the behavior:
PagedSearchIterable<GHContent> searchResultsIter = github.searchContent().filename(fileName).language(language).list().withPageSize(1);
I followed the fix to this: #221 to come up with above code. There is no way to specify page param though.
assert nextResponse.body() != null;
url
param in the method at line 142URL url = nextRequest.url();
Expected behavior
To get the behavior of below GET URL through a way to specify
page
query param as well:https://api.github.com/search/code?q=filename:ThreadSafeLazyLoadedIvoryTowerTest language:Java&per_page=1&page=1
Desktop (please complete the following information):
Additional context
I didn't find a way to limit my search results using both
page_size
andpage
query params. I tried to cheat by using theq
param but Github doesn't not accept the page params in the query-field.The first search API call doesn't not include
page
param.The second auto-search API call added
page
param and increments it everytime until all results are fetched.The text was updated successfully, but these errors were encountered: