Skip to content

searchUsers method is very slow to return data when searching for common words #16

@TheHanna

Description

@TheHanna

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

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions