-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
JavaDestinyAPI/src/main/java/net/dec4234/javadestinyapi/material/DestinyAPI.java
Lines 235 to 248 in bb65398
| for (int i = 0; i < 100; i++) { // Start at page 0 and increment each time until there are no more valid pages | |
| JsonObject jsonObject = httpUtils.urlRequestPOST(HttpUtils.URL_BASE + "/User/Search/GlobalName/" + i + "/", body); | |
| // Only continue looping if the result has a list of search results | |
| if (jsonObject.has("Response") && jsonObject.getAsJsonObject("Response").getAsJsonArray("searchResults").size() != 0) { | |
| JsonArray jsonArray = jsonObject.getAsJsonObject("Response").getAsJsonArray("searchResults"); | |
| for (JsonElement jsonElement : jsonArray) { // Add all user info objects into one list | |
| jsonObjects.add(jsonElement.getAsJsonObject()); | |
| } | |
| } else { | |
| break; | |
| } | |
| } |
Paginating through the API automatically to get all the data at once is an inefficient way handle search. This is slow when searching for common terms in a username, i.e. "guardian"
Ideally, you should simply expose the pagination and allow developers to customize this a bit so that it can be performant
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request