Class SearchUtil
java.lang.Object
com.webmethods.common.search.util.SearchUtil
Utility class that contains helper functions for
search
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Pattern
buildPatternForTerm
(String term) Convert the search term to a regex pattern.static String
buildQueryKey
(ISearchQuery searchQuery) static String
buildRegExForTerm
(String term) Convert the search term to a regex string.buildRegExForTerms
(List<? extends String> terms) Convert the search term list to a list of regex patterns.static boolean
matchesAllRegExPatterns
(String value, List<Pattern> patternList) Check if the given string matches all the regex patterns in the pattern listSplits the given query string to search terms.parseSearchTerms
(String s, boolean normalize) Splits the given query string to search terms.
-
Field Details
-
regexPatternCache
-
-
Constructor Details
-
SearchUtil
public SearchUtil()
-
-
Method Details
-
parseSearchTerms
Splits the given query string to search terms. The string is split at the spaces. If there are quotes in the string the text between the quotes is treated as a single term.- Parameters:
s
- the search query string- Returns:
- list of search terms
-
parseSearchTerms
Splits the given query string to search terms. The string is split at the spaces. If there are quotes in the string the text between the quotes is treated as a single term.- Parameters:
s
- the search query stringnormalize
- true to normalize the string before parsing, false otherwise- Returns:
- list of search terms
-
buildRegExForTerms
Convert the search term list to a list of regex patterns. Uses * as wildcard- Parameters:
terms
- list of search terms- Returns:
- list of regex Pattern objects for the given search terms
-
buildRegExForTerm
Convert the search term to a regex string. Uses * as wildcard- Parameters:
term
- the search term- Returns:
- regex for the given search term
-
buildPatternForTerm
Convert the search term to a regex pattern. Uses * as wildcard- Parameters:
term
- the search term- Returns:
- regex pattern for the given search term
-
matchesAllRegExPatterns
Check if the given string matches all the regex patterns in the pattern list- Parameters:
value
- the string to match againstpatternList
- the list of regex patterns to match- Returns:
- true if the value matches all the patterns, false otherwise
-
buildQueryKey
-