Skip to content

Commit

Permalink
Revert "Hide Modules in Search"
Browse files Browse the repository at this point in the history
Better to show modules all the time for an easy way to tweak settings without going through the hiding process
  • Loading branch information
machiecodes committed Jan 8, 2025
1 parent 064e9b1 commit 4330b79
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,13 @@ public Set<Module> searchTitles(String text) {
Map<Module, Integer> modules = new ValueComparableMap<>(Comparator.naturalOrder());

for (Module module : this.moduleInstances.values()) {
if (Config.get().hiddenModules.get().contains(module)) continue;

int score = Utils.searchLevenshteinDefault(module.title, text, false);
if (Config.get().moduleAliases.get()) {
for (String alias : module.aliases) {
int aliasScore = Utils.searchLevenshteinDefault(alias, text, false);
if (aliasScore < score) score = aliasScore;
}
}

modules.put(module, modules.getOrDefault(module, 0) + score);
}

Expand All @@ -192,16 +189,13 @@ public Set<Module> searchSettingTitles(String text) {
Map<Module, Integer> modules = new ValueComparableMap<>(Comparator.naturalOrder());

for (Module module : this.moduleInstances.values()) {
if (Config.get().hiddenModules.get().contains(module)) continue;

int lowest = Integer.MAX_VALUE;
for (SettingGroup sg : module.settings) {
for (Setting<?> setting : sg) {
int score = Utils.searchLevenshteinDefault(setting.title, text, false);
if (score < lowest) lowest = score;
}
}

modules.put(module, modules.getOrDefault(module, 0) + lowest);
}

Expand Down

0 comments on commit 4330b79

Please sign in to comment.