Skip to content

Commit a251c53

Browse files
committed
ModuleSearcher: filter out inappropriate modules
Modules that are not visible, enabled and valid should be excluded.
1 parent 4145aaf commit a251c53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/scijava/search/module/ModuleSearcher.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ public List<SearchResult> search(final String text, final boolean fuzzy) {
7676

7777
final LinkedHashSet<ModuleInfo> matches = new LinkedHashSet<>();
7878

79-
final List<ModuleInfo> modules = moduleService.getModules();
79+
// Get the list of all enabled, visible, valid modules.
80+
final List<ModuleInfo> modules = moduleService.getModules().stream() //
81+
.filter(ModuleInfo::isEnabled) //
82+
.filter(ModuleInfo::isVisible) //
83+
.filter(ModuleInfo::isValid) //
84+
.collect(Collectors.toList());
8085

8186
final String textLower = text.toLowerCase();
8287

0 commit comments

Comments
 (0)