public class SearchUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static Map<String,Pattern> |
regexPatternCache |
Constructor and Description |
---|
SearchUtil() |
Modifier and Type | Method and Description |
---|---|
static 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.
|
static List<Pattern> |
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 list
|
static List<String> |
parseSearchTerms(String s)
Splits the given query string to search terms.
|
static List<String> |
parseSearchTerms(String s,
boolean normalize)
Splits the given query string to search terms.
|
public static List<String> parseSearchTerms(String s)
s
- the search query stringpublic static List<String> parseSearchTerms(String s, boolean normalize)
s
- the search query stringnormalize
- true to normalize the string before parsing, false otherwisepublic static List<Pattern> buildRegExForTerms(List<? extends String> terms)
terms
- list of search termspublic static String buildRegExForTerm(String term)
term
- the search termpublic static Pattern buildPatternForTerm(String term)
term
- the search termpublic static boolean matchesAllRegExPatterns(String value, List<Pattern> patternList)
value
- the string to match againstpatternList
- the list of regex patterns to matchpublic static String buildQueryKey(ISearchQuery searchQuery)