Class AbstractSearchParser

    • Constructor Detail

      • AbstractSearchParser

        public AbstractSearchParser()
    • Method Detail

      • getPrecedingText

        public static String getPrecedingText​(String text,
                                              int hitStartIndex,
                                              int maxLength)

        getPrecedingText.

        Parameters:
        text - a String object.
        hitStartIndex - a int.
        maxLength - a int.
        Returns:
        a String object.
      • getSucceedingText

        public static String getSucceedingText​(String text,
                                               int hitEndIndex,
                                               int maxLength)

        getSucceedingText.

        Parameters:
        text - a String object.
        hitEndIndex - a int.
        maxLength - a int.
        Returns:
        a String object.
      • getSingleWordRegex

        public static String getSingleWordRegex​(String query)

        getSingleWordRegex.

        Parameters:
        query - a String object.
        Returns:
        a regex matching a single word matching the given query regex (ignoring case)
      • getContainedWordRegex

        public static String getContainedWordRegex​(String query)

        getContainedWordRegex.

        Parameters:
        query - a String object.
        Returns:
        a regex matching any text containing the given query regex as single word
      • getQueryRegex

        public static String getQueryRegex​(String query)

        getQueryRegex.

        Parameters:
        query - a String object.
        Returns:
        a regex matching any word or sequence of words of the given query with '*' matching any number of word characters and ignoring case
      • getAutoSuggestRegex

        public static String getAutoSuggestRegex​(String query)
        Create a regular expression matching all anything starting with the given query followed by an arbitrary number of word characters and ignoring case
        Parameters:
        query - a String object.
        Returns:
        the regular expression (?i){query}[\w\d-]*