PdfLibrary

PdfLibrary implements a SQLite-based full-text-search engine. You can register documents to be indexed in the background and then search for keywords within that collection. There can be multiple libraries, although usually one is enough for the common use case.

See also

<a

href="https://pspdfkit.com/guides/android/current/features/indexed-full-text-search/">Indexed Full text search

Types

Link copied to clipboard
@Retention(value = SOURCE)
annotation class Tokenizer

Properties

Link copied to clipboard
val PORTER_TOKENIZER: String = "PorterTokenizer"
The name of PSPDFKit's custom porter tokenizer that allows better CJK indexing.
Link copied to clipboard
val UNICODE_TOKENIZER: String = "UnicodeTokenizer"
The name of PSPDFKit's custom Unicode tokenizer.

Functions

Link copied to clipboard
Adds a LibraryIndexingListener to monitor document indexing status.
Link copied to clipboard
open fun clearIndex()
Completely clears the index for this library.
Link copied to clipboard
open fun enqueueDocuments(@NonNull documents: List<PdfDocument>)
open fun enqueueDocuments(@NonNull documents: List<PdfDocument>, @NonNull indexingOptions: IndexingOptions)
Queues an array of documents for indexing.
Link copied to clipboard
open fun enqueueDocumentSources(@NonNull documentSources: List<DocumentSource>)
Queues an array of documents for indexing.
Link copied to clipboard
Queues an array of documents for indexing together with passed free-form metadata.
Link copied to clipboard
Queues an array of documents for indexing together with passed free-form metadata.
Link copied to clipboard
open fun get(@NonNull path: String): PdfLibrary
open fun get(@NonNull path: String, @NonNull tokenizer: String): PdfLibrary
Returns a library for a given path.
Link copied to clipboard
Returns list of UIDs of documents currently indexed.
Link copied to clipboard
Returns indexing status for a document with passed UID.
Link copied to clipboard
Returns metadata appended to document with enqueueDocumentsWithMetadata call.
Link copied to clipboard
Returns list of UIDs of documents queued for indexing.
Link copied to clipboard
Indicates whether saving the reverse text is enabled.
Link copied to clipboard
open fun isIndexing(): Boolean
Indicates whether the indexing is in progress or not.
Link copied to clipboard
open fun removeDocuments(@NonNull documentUIDs: List<String>)
Invalidates index for documents.
Link copied to clipboard
open fun search(@NonNull searchString: String, @Nullable options: QueryOptions, @NonNull resultListener: QueryResultListener)
Query the database for a match of searchString.
Link copied to clipboard
open fun setSaveReverseText(saveReverseText: Boolean)
Will save a reversed copy of the original page text.
Link copied to clipboard
open fun size(): Int
Returns number of indexed documents in this library.
Link copied to clipboard
open fun stopSearch()
Stops search and all in-progress preview text generator tasks.