readest/apps/readest-app/public/workers
Mohammed Efaz a6a3e14996
feat(library): add scoped full text search with fuzzy and nearby modes (#5389)
* feat(search): add progressive library search engine

* feat(library): add tag and subject shelves

* feat(library): add full-text search interface

* chore(search): add library scan benchmark

* fix(library): restore integrated search icon

* fix(search): scan loadable library books

* fix(search): keep nearby settings open

* fix(search): hide completed scan progress

* feat(search): add grouped result navigator

* feat(search): highlight clicked reader sentence

* perf(search): speed up library content scans

* fix(library): normalize tag shelf links

* fix(library): reflect url shelf grouping

* fix(search): scope fuzzy mode to library

* fix(search): preserve decomposed diacritic ranges

* test(search): consolidate core coverage

* fix(library): stabilize search input flow

* fix(search): improve result row spacing

* fix(search): smooth reader result highlight

* fix(library): prioritize search menu dismissal

* fix(library): stabilize result navigation dots

* perf(library): optimize full-text search

* test(library): align open book router mock

* refactor(search): rebuild library search on a per-book search.db index

Replace the in-memory scan pipeline with a persistent per-book Turso
index (search.db beside cover.png): search_meta/search_sections store
extracted, folded section text, search_nodes stores the toc tree for
future retrieval features. First scan populates the index; repeat
searches match cached text via a folded LIKE prefilter plus exact JS
matchers and never reopen book files. Results carry text-offset locators
and CFIs resolve lazily on click. Freshness follows book.updatedAt plus
a nav hash so manual toc edits invalidate. Turso is WAL-only with no
auto-checkpoint, so index writes checkpoint explicitly and all database
close paths checkpoint before closing. Unavailable books skip in
milliseconds via an IDBKeyRange readDir fix and databaseExists probes,
and stale index artifacts self-delete. Per-book results cap at 500 while
the scan continues across books. CJK nearby search falls back to
substring word mapping and counts distances in grapheme clusters.
foliate's text-walker loads lazily so the SSR module graph never touches
NodeFilter. Benchmarks cover real en/zh prose at 10/100/1000-book scale.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(library): redesign the full-text search UI

Results render as cover-thumb cards with sticky book headers replacing
the dot navigator, folded by default with per-book match counts (500+
when capped) and a live unavailable-books footer. Search options move
into a reader-style dropdown attached to the input; the import and
select controls hide in text mode and the mode toggles via the search
icon. The query input debounces 500ms, search history pills show under
the header between the search bar and breadcrumbs, and a completed scan
snapshot restores results and expanded groups when returning from the
reader. Progress reuses the sync bar style; matches emphasize with the
shared search-term-highlight class; everything stays legible under
data-eink with responsive header-aligned padding. Book opening keeps
useAppRouter so route View Transitions (and their engine gating) apply
to search result deep links too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(reader): search through the shared book index and translate new strings

Reader search now queries the same per-book search.db: repeat searches
skip book parsing, chapter scope maps to a sectionIndex filter that
never restricts index population, and a batch resolver turns locators
into CFIs (per-word for nearby matches) that view.search replays purely
to paint highlights. The legacy per-query JSON cache under Cache/search
is removed and wiped once at startup. Excerpt rows clip their lead-in so
the emphasized match stays inside the three-line clamp, using the shared
search-term-highlight class. All new library search strings are
translated across the 32 locales.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor(metadata): edit tags like other fields

Tags edit through the standard FormField as a comma-separated string,
exactly like Subjects: per-field lock, shared chrome, separator split in
the field pipeline. The custom chip editor with its own Add button and
key handling is removed; the read-only view keeps chips. Empty segments
survive while typing so a just-typed comma is not swallowed, and tags
dedupe on save.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Huang Xin <chrox.huang@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-01 21:24:31 +02:00
..
library-search-algorithms.js feat(library): add scoped full text search with fuzzy and nearby modes (#5389) 2026-08-01 21:24:31 +02:00
library-search.worker.js feat(library): add scoped full text search with fuzzy and nearby modes (#5389) 2026-08-01 21:24:31 +02:00