java.lang.Object | |
↳ | com.pspdfkit.document.search.SearchResult |
Represents a result found when searching for text.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | SearchResult.TextSnippet | The SearchResult.TextSnippet can be extracted with a search result to present a preview text to
the user. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public final Annotation | annotation | Annotation that contains the search result. | |||||||||
public final PdfDocument | document | ||||||||||
public final int | pageIndex | Page number of the page holding the search result. | |||||||||
public final SearchResult.TextSnippet | snippet | Search result snippet (preview text). | |||||||||
public final TextBlock | textBlock | The search result text (containing the actual string, indices and text coordinates). |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SearchResult(int pageIndex, TextBlock textBlock, SearchResult.TextSnippet snippet, Annotation annotation, PdfDocument document)
Private constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | compareTo(SearchResult another) | ||||||||||
static SearchResult |
create(PdfDocument document, Annotation annotation, Range range, int snippetLength)
Create an immutable search result with a preview snippet from annotation text.
| ||||||||||
static SearchResult |
create(PdfDocument document, int pageIndex, Range range, int snippetLength)
Creates an immutable search result with a preview snippet from page text
| ||||||||||
String | toString() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Annotation that contains the search result. Valid only when search result was found inside annotation contents. When null, search result was found in page text.
Page number of the page holding the search result.
Search result snippet (preview text). May be null
if snippet extraction has been
turned off.
The search result text (containing the actual string, indices and text coordinates).
Private constructor. Use one of the static factory methods instead.
Create an immutable search result with a preview snippet from annotation text.
document | Document which contains the search result. |
---|---|
annotation | Annotation containing the search result. |
range | Character range in annotation contents marking the search result. |
snippetLength | Length of the preview snippet to extract. May be 0 to not
extract any snippet. |
Creates an immutable search result with a preview snippet from page text
document | Document which contains the search result. |
---|---|
pageIndex | 0-indexed page number of the result. |
range | Character range on the page marking the search result. |
snippetLength | Length of the preview snippet to extract. May be 0 to not
extract any snippet. |