mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-04 03:46:57 -04:00
Always sort the results while searching in CurseForge. (#2916)
This commit is contained in:
parent
389b93178e
commit
ba91c60e95
@ -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();
|
||||
@ -112,7 +112,7 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
|
||||
.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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user