Skip to content

How to search through a publication? #34

Answered by mickael-menu
openm1nd asked this question in Q&A
Discussion options

You must be logged in to vote

You can read a specification of how the search feature works in Readium with this proposal: https://readium.org/architecture/proposals/007-search-service

For the Swift implementation, first know that this feature is currently experimental, so any API starting with an underscore may change a bit in the future.

  1. Before displaying the search UX, first check if a Publication supports search with publication._isSearchable
  2. When you are ready to perform a search, call publication._search(query: "banana") { result in ... }
    • If the search is a success, the completion block will be called with a SearchIterator object you can use to iterate over the pages of results.
    • _search() returns a Cancellable

Replies: 0 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mickael-menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants