Pdf Library
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.
Parameters
Writable path to library database file.
The tokenizer to use, one of TokenizerType.PORTER or TokenizerType.UNICODE. This controls how the PdfLibrary matches queries to the content in the index. If null is passed, TokenizerType.PORTER will be used as the default tokenizer.
See also
Types
Properties
The library's data source. This object will be retained and used to provide documents for indexing. When set, the library can use updateIndexFromDataSource to automatically index documents provided by the data source.
Returns list of UIDs of documents currently indexed.
Indicates whether the indexing is in progress or not.
Returns list of UIDs of documents queued for indexing.
Functions
Adds a LibraryIndexingListener to monitor document indexing status. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.
Completely clears the index for this library.
Queues an array of documents for indexing. Any documents already queued or fully indexed will be ignored.
Queues an array of documents for indexing. Any documents already queued or fully indexed will be ignored. This call will avoid opening documents until they're indexed and it's thus significantly more memory friendly than enqueueDocuments.
Queues an array of documents for indexing together with passed free-form metadata. This call will avoid opening documents until they're indexed and it's thus significantly more memory friendly than enqueueDocumentsWithMetadata.
Queues an array of documents for indexing together with passed free-form metadata. Metadata can be retrieved after indexing with getMetadataForUID method call.
Returns indexing status for a document with passed UID.
Returns metadata appended to document with enqueueDocumentsWithMetadata call.
Indicates whether saving the reverse text is enabled.
Retrieves a document source with the specified UID from the data source, if any. Using this method is preferred to directly interacting with the data source's methods.
Invalidates index for documents.
Removes a registered LibraryIndexingListener added with addLibraryIndexingListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed, and will result in an exception.
Query the database for a match of searchString. Only direct matches, begins-with and ends-with matches are supported. Returns a map of document UIDs to set of pages matching inside that document.
Will save a reversed copy of the original page text. If enabled the index database will be about 2x bigger, but ends-with matches will be enabled.
Stops search and all in-progress preview text generator tasks.
Updates the index based on information provided by the data source. If there is no data source set, this method will throw an IllegalStateException. Any currently queued documents will be removed.