Postgres' english websearch_to_tsquery dropped stopwords; FTS5 indexes them.
A stopword matches most of the library, so a search containing one read its
whole doclist (slow on a cold HDD) and only found files that happened to
contain it. translate_websearch now drops Postgres' english stopword list
from unquoted terms; quoted phrases keep them.
A search with nothing left to search (stopwords or punctuation only) now
matches nothing in archive, video and doc search too, as files search, the
search estimates and Postgres already did, instead of listing everything.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The title sort ordered by `a_text` (the indexed words) with binary collation:
uppercase titles sorted before all lowercase ones ("AWLS" before "Alps"), and
Docs with no indexed words sorted last though they show a title.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Search results sort as the filter dialog says
Docs sorted ascending orders backwards and fell back to id order for every
descending order (`-size`, `-published_datetime`); it now takes the same `-`
prefixed orders as the other searches and rejects unknown ones with a 400.
Archives and Docs searches without an order now put the most relevant results
first, as Videos does and as the dialog shows.
Rank has no direction in the dialog: choosing it sends `rank` (most relevant
first) instead of inheriting a descending `-rank` (least relevant first).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An old -rank link becomes rank when the filter dialog closes
The dialog shows Rank without a direction, but it seeded its draft from the URL
unchanged, so Done left a saved `-rank` (least relevant first) in place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The filter modal on these pages offered "Any Tag", but only the Files search
sent it; the module searches had no `any_tag` field. Docs also matched any of
the listed tag_names, while every other search requires all of them.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Viewing an archive or a doc marked it viewed on the request's read transaction. SQLite cannot
upgrade a read to a writer once another connection has committed (during a download or refresh),
and it does not wait on busy_timeout for that. The archive page returned a 500; the doc page
returned 200 but its view was lost when the request's commit failed.
Build the response on the read, then record the view in `request.ctx.db.write()`, as the video
page already does.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Opening a doc on its page never set FileGroup.viewed, so docs were missing
from Recently Viewed. GET /api/docs/:id now marks the doc viewed, with the
same skip_viewed parameter as archives and videos.
The file preview marked a file viewed more than once: opening from a
?preview= URL sent two tracked requests, and every tag change re-fetched the
file with tracking on. The fetches now skip tracking, and the preview marks
each opening viewed once.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Create a new Docs module that consolidates PDF and eBook handling into a
unified system with subjects and authors support. This replaces the
separate PDF/eBook modelers with a single Doc model backed by an
alembic migration (rename ebook to doc).
Key changes:
- New modules/docs package with models, API, extractors, and lib
- Subject and author metadata extraction with case-insensitive
normalization for cleaner PDF metadata
- Frontend Docs pages with AuthorsPage, SubjectsPage using
CollectionTable, and doc card deletion
- Global search integration for subjects and authors
- Generic collection item count support
- Frontend file card metadata adjusted to match collection sort
- Bump yt-dlp version