Package com.pspdfkit.document.search
Class SearchResult
-
- All Implemented Interfaces:
-
java.lang.Comparable
public final class SearchResult implements Comparable<T>
Represents a result found when searching for text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
SearchResult.TextSnippet
The TextSnippet can be extracted with a search result to present a preview text to the user.
-
Field Summary
Fields Modifier and Type Field Description public final int
pageIndex
public final Annotation
annotation
public final TextBlock
textBlock
public final SearchResult.TextSnippet
snippet
public final PdfDocument
document
-
Constructor Summary
Constructors Constructor Description SearchResult(int pageIndex, TextBlock textBlock, SearchResult.TextSnippet snippet, Annotation annotation, PdfDocument document)
Private constructor.
-
Method Summary
Modifier and Type Method Description static SearchResult
create(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex, @NonNull() Range range, @IntRange(from = 0) int snippetLength)
Creates an immutable search result with a preview snippet from page text static SearchResult
create(@NonNull() PdfDocument document, @NonNull() Annotation annotation, @NonNull() Range range, @IntRange(from = 0) int snippetLength)
Create an immutable search result with a preview snippet from annotation text. int
compareTo(@NonNull() SearchResult another)
String
toString()
-
-
Constructor Detail
-
SearchResult
SearchResult(int pageIndex, TextBlock textBlock, SearchResult.TextSnippet snippet, Annotation annotation, PdfDocument document)
Private constructor.
-
-
Method Detail
-
create
static SearchResult create(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex, @NonNull() Range range, @IntRange(from = 0) int snippetLength)
Creates an immutable search result with a preview snippet from page text
- Parameters:
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.- Returns:
A search result extracted from the document.
-
create
static SearchResult create(@NonNull() PdfDocument document, @NonNull() Annotation annotation, @NonNull() Range range, @IntRange(from = 0) int snippetLength)
Create an immutable search result with a preview snippet from annotation text.
- Parameters:
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.- Returns:
A search result extracted from the document.
-
compareTo
int compareTo(@NonNull() SearchResult another)
-
-
-
-