com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class SearchHighlightOptions



  • public final class SearchHighlightOptions
    extends Object

    Provides options of highlight.


    SearchHighlightOptions class is used to define highlight extraction in search results. Instead of HighlightOptions SearchHighlightOptions class contains the information of two highlights - the left highlight (a text on the left side of the found text) and the right highlight (a text on the left side of the found text).

    The highlight size can be set in characters, words count and to line's start (end). Highlight starts from the start (for the left) or end (for the right) of the found text.

    • Method Detail

      • getHighlightMode

        public int getHighlightMode()

        Gets a mode of highlight extraction.

        Returns:
        A mode of highlight extraction.
      • getLeftLength

        public int getLeftLength()

        Gets a length of the left highlight.

        Returns:
        A length of the left highlight.
      • getRightLength

        public int getRightLength()

        Gets a length of the right highlight.

        Returns:
        A length of the right highlight.
      • createFixedLengthOptions

        public static SearchHighlightOptions createFixedLengthOptions(int length)

        Creates an instance of SearchHighlightOptions for highlight extraction with the fixed length.

        Parameters:
        length - The value of length of the left and right highlight.
        Returns:
        An instance of SearchHighlightOptions.
      • createFixedLengthOptions

        public static SearchHighlightOptions createFixedLengthOptions(int leftLength,
                                                      int rightLength)

        Creates an instance of SearchHighlightOptions for highlight extraction with the fixed length.

        Parameters:
        leftLength - The value of length of the left highlight.
        rightLength - The value of length of the right highlight.
        Returns:
        An instance of SearchHighlightOptions.
      • createWordsCountOptions

        public static SearchHighlightOptions createWordsCountOptions(int wordsCount)

        Creates an instance of SearchHighlightOptions for highlight extraction with the limited words count.

        Parameters:
        wordsCount - The value of words count of the left and right highlight.
        Returns:
        An instance of SearchHighlightOptions.
      • createWordsCountOptions

        public static SearchHighlightOptions createWordsCountOptions(int leftWordsCount,
                                                     int rightWordsCount)

        Creates an instance of SearchHighlightOptions for highlight extraction with the limited words count.

        Parameters:
        leftWordsCount - The value of words count of the left highlight.
        rightWordsCount - The value of words count of the right highlight.
        Returns:
        An instance of SearchHighlightOptions.
      • createLineOptions

        public static SearchHighlightOptions createLineOptions()

        Creates an instance of SearchHighlightOptions for highlight extraction to line's start (end).

        Returns:
        An instance of SearchHighlightOptions.
      • createLineOptions

        public static SearchHighlightOptions createLineOptions(int maxLength)

        Creates an instance of SearchHighlightOptions for highlight extraction to line's start (end).

        Parameters:
        maxLength - The value of maximum length of the left and right highlight.
        Returns:
        An instance of SearchHighlightOptions.
      • createLineOptions

        public static SearchHighlightOptions createLineOptions(int leftMaxLength,
                                               int rightMaxLength)

        Creates an instance of SearchHighlightOptions for highlight extraction to line's start (end).

        Parameters:
        leftMaxLength - The value of maximum length of the left highlight.
        rightMaxLength - The value of maximum length of the right highlight.
        Returns:
        An instance of SearchHighlightOptions.