readium / swift-toolkit

A toolkit for ebooks, audiobooks and comics written in Swift
https://readium.org/mobile/
BSD 3-Clause "New" or "Revised" License
222 stars 96 forks source link

[Bug] Search Result Chapter Title #444

Closed vedat73 closed 1 month ago

vedat73 commented 1 month ago

Describe the bug

Hello, I want to show chapter title of the search results when user perform a search operation on a book. So users can see which chapter the search result belongs to.
I thought that I can get it via LocatorCollection-> links[n] -> title but unfortunately it returns an empty array.

How to reproduce?

  1. Open demo app
  2. Open a book
  3. Open search view
  4. Type a word
  5. Review search result

Readium version

2.7.1

OS version

iOS 17.2

Testing device

iPhone 15 Pro

Environment

macOS: 14.4.1
platform: arm64
Xcode 15.2

Additional context

No response

mickael-menu commented 1 month ago

It is supported but with a limited scope: chapter sections inside a resource are ignored. Could you share a publication that shows the problem?

vedat73 commented 1 month ago

Hi @mickael-menu , so sorry for late reply. You can download the book called "Law of Wills" from OPDS -> Open Textbooks Catalog. Actually in searching, the search result does not contain chapter info. So I can't see which chapter the search result belongs to.

mickael-menu commented 1 month ago

Thank you for reporting the issue. There was indeed a bug lurking.

https://github.com/readium/swift-toolkit/pull/446

vedat73 commented 1 month ago

thanks @mickael-menu for this quick fix. Can you provide a small example that I can use to get chapter title out of search results. Also can I get the fixed version as uploading the readium package in my project?

mickael-menu commented 1 month ago

I will publish today or tomorrow a new 2.7.2 version which will contain the fix.

You can create a new chapter section in your search result list every time you see a different title in locator.title of each search result. This is not implemented in the Test App.

vedat73 commented 1 month ago

ok, will be waiting for that. Thanks...