Skip to content

Commit 82fa330

Browse files
committed
ModuleSearcher: fix text case comparison bug
When capital letters or mixed case is typed, we still want to match.
1 parent 4536e62 commit 82fa330

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ public List<SearchResult> search(final String text, final boolean fuzzy) {
7575

7676
final List<ModuleInfo> modules = moduleService.getModules();
7777

78+
final String textLower = text.toLowerCase();
79+
7880
// Add modules with matching titles first.
7981
modules.stream() //
80-
.filter(info -> matches(info.getTitle(), text)) //
82+
.filter(info -> matches(info.getTitle(), textLower)) //
8183
.forEach(matches::add);
8284

8385
// Add modules with matching menu paths after that.
8486
modules.stream() //
85-
.filter(info -> matches(info.getMenuPath().toString(), text)) //
87+
.filter(info -> matches(info.getMenuPath().toString(), textLower)) //
8688
.forEach(matches::add);
8789

8890
// Wrap each matching ModuleInfo in a ModuleSearchResult.

0 commit comments

Comments
 (0)