@@ -88,12 +88,12 @@ public List<SearchResult> search(final String text, final boolean fuzzy) {
8888
8989 // Next, add modules where title has text inside somewhere.
9090 modules .stream () //
91- .filter (info -> hasSubstring (info , textLower )) //
91+ .filter (info -> hasSubstringInTitle (info , textLower )) //
9292 .forEach (matches ::add );
9393
9494 // Finally, add modules where menu path has text inside somewhere.
9595 modules .stream () //
96- .filter (info -> hasSubstring (info , textLower )) //
96+ .filter (info -> hasSubstringInMenu (info , textLower )) //
9797 .forEach (matches ::add );
9898
9999 // Wrap each matching ModuleInfo in a ModuleSearchResult.
@@ -160,11 +160,19 @@ private boolean startsWith(final ModuleInfo info, final String desiredLower) {
160160 return title != null && title .toLowerCase ().startsWith (desiredLower );
161161 }
162162
163- private boolean hasSubstring (final ModuleInfo info ,
164- final String desiredLower )
163+ private boolean hasSubstringInTitle (final ModuleInfo info ,
164+ final String desiredLower )
165165 {
166166 final String title = title (info );
167167 return title != null && //
168168 title .toLowerCase ().matches (".*" + desiredLower + ".*" );
169169 }
170+
171+ private boolean hasSubstringInMenu (final ModuleInfo info ,
172+ final String desiredLower )
173+ {
174+ MenuPath menuPath = info .getMenuPath ();
175+ if (menuPath == null ) return false ;
176+ return menuPath .stream ().anyMatch (entry -> entry .getName ().toLowerCase ().contains (desiredLower ));
177+ }
170178}
0 commit comments