Skip to content

Commit

Permalink
Always sort the results while searching in CurseForge. (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt authored Mar 10, 2024
1 parent 389b931 commit ba91c60
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
private static final String PREFIX = "https://api.curseforge.com";
private static final String apiKey = System.getProperty("hmcl.curseforge.apikey", JarUtils.getManifestAttribute("CurseForge-Api-Key", ""));

private static final int WORD_PERFECT_MATCH_WEIGHT = 50;
private static final int WORD_PERFECT_MATCH_WEIGHT = 5;

public static boolean isAvailable() {
return !apiKey.isEmpty();
Expand Down Expand Up @@ -112,7 +112,7 @@ public SearchResult search(String gameVersion, @Nullable RemoteModRepository.Cat
.getJson(new TypeToken<Response<List<CurseAddon>>>() {
}.getType());
Stream<RemoteMod> res = response.getData().stream().map(CurseAddon::toMod);
if (sortType != SortType.NAME || searchFilter.isEmpty()) {
if (searchFilter.isEmpty()) {
return new SearchResult(res, (int)Math.ceil((double)response.pagination.totalCount / pageSize));
}

Expand Down

0 comments on commit ba91c60

Please sign in to comment.