SearchActions

Generic interface for handling searching the document with a query.

Parameters

R

: The type of the search result

Q

: The type of the search query

S

: The type of the search state

Inheritors

Functions

Link copied to clipboard
abstract fun isQuerySearchable(query: Q): Boolean

Returns true if the given query can/should be searched.

Link copied to clipboard
abstract fun isSearchCompletedForQuery(query: Q): Boolean

Returns true if the search is completed for the given query - and hence no search is needed.

Link copied to clipboard
abstract suspend fun resetSearch()

Cancel the current search and clear results

Link copied to clipboard
abstract suspend fun search(query: Q)

Searches the document with the given query. This function will update the search state associated with this SearchActions object in the DocumentController. (e.g. calling DocumentController.textSearch.actions.search(query) will emit to the StateFlow of DocumentController.textSearch).

Link copied to clipboard
abstract suspend fun selectResult(index: Int)

Mark the result at the given index as selected. This method will always update the search state of the feature.

Link copied to clipboard
abstract suspend fun setExternalState(state: S)

Assigns a SearchState to the search feature, which can be used to highlight search results on the document pages. Use this method with caution, as inconsistent data can lead to unexpected behavior. If you just pass in the the status as you receive it from the search, you should be fine, but be careful when manipulating the results (e.g. removing or adding results).