Interface SearchFilter
- All Superinterfaces:
BiPredicate<MenuItem,String>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a filter for matching menu items against a search query. Used by typeahead components and
MenuSearch to
determine which items are visible for a given input value.- See Also:
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic SearchFiltercontains()Creates a filter that matches menu items whose text contains the search query (case-insensitive).static SearchFiltercontainsAll(char delimiter) Creates a filter that splits the search query by the given delimiter, then checks that the menu item's text contains all non-empty terms (case-insensitive).static SearchFilterlastSegment(char delimiter) Creates a filter that uses only the text after the last occurrence of the given delimiter for matching.Methods inherited from interface BiPredicate
and, negate, or, test
-
Method Details
-
contains
Creates a filter that matches menu items whose text contains the search query (case-insensitive).- Returns:
- a
SearchFilterthat evaluates totrueif the menu item's text contains the search text (case-insensitive).
-
containsAll
Creates a filter that splits the search query by the given delimiter, then checks that the menu item's text contains all non-empty terms (case-insensitive). For example, with delimiter'/', the query"tolkien/rings"matches any item whose text contains both "tolkien" and "rings".- Parameters:
delimiter- the character used to split the query into terms- Returns:
- a
SearchFilterthat matches items containing all query terms
-
lastSegment
Creates a filter that uses only the text after the last occurrence of the given delimiter for matching. If the delimiter is not present, the entire query is used. Matching is case-insensitive.This is useful for hierarchical typeaheads where the text before the delimiter selects a category, and the text after it filters within that category. For example, with delimiter
'/', the query"laptops/mac"filters items using only "mac".- Parameters:
delimiter- the character that separates hierarchical segments- Returns:
- a
SearchFilterthat matches items against the last segment of the query
-