Class SearchUtil

java.lang.Object
com.webmethods.common.search.util.SearchUtil

public class SearchUtil extends Object
Utility class that contains helper functions for search
  • Field Details

  • Constructor Details

    • SearchUtil

      public SearchUtil()
  • Method Details

    • parseSearchTerms

      public static List<String> parseSearchTerms(String s)
      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

      public static List<String> parseSearchTerms(String s, boolean normalize)
      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
      normalize - true to normalize the string before parsing, false otherwise
      Returns:
      list of search terms
    • buildRegExForTerms

      public static List<Pattern> buildRegExForTerms(List<? extends String> terms)
      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

      public static String buildRegExForTerm(String term)
      Convert the search term to a regex string. Uses * as wildcard
      Parameters:
      term - the search term
      Returns:
      regex for the given search term
    • buildPatternForTerm

      public static Pattern buildPatternForTerm(String term)
      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

      public static boolean matchesAllRegExPatterns(String value, List<Pattern> patternList)
      Check if the given string matches all the regex patterns in the pattern list
      Parameters:
      value - the string to match against
      patternList - the list of regex patterns to match
      Returns:
      true if the value matches all the patterns, false otherwise
    • buildQueryKey

      public static String buildQueryKey(ISearchQuery searchQuery)