SearchResult

Inheritance: java.lang.Object

public class SearchResult

Represents the search result in the search functionality.

An instance of SearchResult class is used as return value of Parser.search(String) and Parser.search(String, com.groupdocs.parser.options.SearchOptions) methods. See the usage examples there.

Constructors

Constructor Description
SearchResult(int position, String text, Integer pageIndex, HighlightItem leftHighlightItem, HighlightItem rightHighlightItem) Initializes a new instance of the SearchResult class.
SearchResult(int position, String text, Integer pageIndex) Initializes a new instance of the SearchResult class.

Methods

Method Description
getPosition() Gets the position in the document text.
getText() Gets the text.
getPageIndex() Gets the page index where the text is found.
getLeftHighlightItem() Gets the left highlight.
getRightHighlightItem() Gets the right highlight.

SearchResult(int position, String text, Integer pageIndex, HighlightItem leftHighlightItem, HighlightItem rightHighlightItem)

public SearchResult(int position, String text, Integer pageIndex, HighlightItem leftHighlightItem, HighlightItem rightHighlightItem)

Initializes a new instance of the SearchResult class.

Parameters:

Parameter Type Description
position int The position in the document text.
text java.lang.String The found text.
pageIndex java.lang.Integer The page index where the text is found.
leftHighlightItem HighlightItem The left highlight.
rightHighlightItem HighlightItem The right highlight.

SearchResult(int position, String text, Integer pageIndex)

public SearchResult(int position, String text, Integer pageIndex)

Initializes a new instance of the SearchResult class.

Parameters:

Parameter Type Description
position int The position in the document text.
text java.lang.String The found text.
pageIndex java.lang.Integer The page index where the text is found.

getPosition()

public int getPosition()

Gets the position in the document text.

Returns: int - A zero-based index of the start position of the search result.

getText()

public String getText()

Gets the text.

Returns: java.lang.String - A string value that respresents the found text.

getPageIndex()

public Integer getPageIndex()

Gets the page index where the text is found.

Returns: java.lang.Integer - A zero-based index of the page where the text is found; null if the seach is performed on the whole document text.

getLeftHighlightItem()

public HighlightItem getLeftHighlightItem()

Gets the left highlight.

Returns: HighlightItem - An instance of HighlightItem class; null if it isn’t set.

getRightHighlightItem()

public HighlightItem getRightHighlightItem()

Gets the right highlight.

Returns: HighlightItem - An instance of HighlightItem class; null if it isn’t set.