StringSearchService

class StringSearchService(manifest: Manifest, container: Container<Resource>, services: PublicationServicesHolder, language: String?, snippetLength: Int, searchAlgorithm: StringSearchService.Algorithm, extractorFactory: ResourceContentExtractor.Factory) : SearchService

Base implementation of SearchService iterating through the content of Publication's resources.

To stay media-type-agnostic, StringSearchService relies on ResourceContentExtractor implementations to retrieve the pure text content from markups (e.g. HTML) or binary (e.g. PDF) resources.

The actual search is implemented by the provided searchAlgorithm.

Constructors

Link copied to clipboard
constructor(manifest: Manifest, container: Container<Resource>, services: PublicationServicesHolder, language: String?, snippetLength: Int, searchAlgorithm: StringSearchService.Algorithm, extractorFactory: ResourceContentExtractor.Factory)

Types

Link copied to clipboard
interface Algorithm

Implements the actual search algorithm in sanitized text content.

Link copied to clipboard
object Companion
Link copied to clipboard

Implementation of a search Algorithm using ICU components to perform the actual search while taking into account languages specificities.

Link copied to clipboard

A naive search Algorithm performing exact matches on strings.

Properties

Link copied to clipboard
open override val options: SearchService.Options

Default value for the search options of this service.

Functions

Link copied to clipboard
open override fun close()

Closes any opened file handles, removes temporary files, etc.

Link copied to clipboard
open suspend override fun search(query: String, options: SearchService.Options?): SearchIterator

Starts a new search through the publication content, with the given query.