wrolpi/modules/docs
Roland 56c3a16839 Fix doc_modeler skipping already-indexed docs
The doc_modeler gated its query on `FileGroup.indexed == False`, but
`indexed` is a full-text-search flag that `apply_indexers` sets on every
FileGroup during a refresh. Because the refresh pipeline runs
apply_modelers -> apply_indexers, any doc file that reached apply_indexers
without first receiving a Doc row (modeler errored, was interrupted, or
files imported already-indexed) got `indexed=1` and was then excluded by
the `indexed == False` gate forever -- leaving it with model=NULL, no Doc
row, and invisible in /api/docs.

On one library this stranded 20,795 PDFs/epubs/mobis (only the 10
individually-tagged docs, modeled via the per-file do_model path, showed
up). No doc-mimetype files were left with indexed=0, so nothing would
ever recover them.

Gate the modeler on "no Doc row yet OR explicitly flagged for
re-indexing" instead, so already-indexed docs are picked up on the next
refresh while preserving re-index behavior and skipping already-modeled
docs. Self-healing: a global refresh now models the backlog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 13:07:32 -06:00
..
test Fix doc_modeler skipping already-indexed docs 2026-07-20 13:07:32 -06:00
__init__.py Fix doc_modeler skipping already-indexed docs 2026-07-20 13:07:32 -06:00
api.py Search: fast ABC mode by default, opt-in deep search 2026-07-03 10:32:16 -06:00
conftest.py Add Docs module for searching and organizing PDFs and EPUBs 2026-03-20 14:17:06 -06:00
extractors.py Adding simple search to epub viewer. 2026-04-13 17:23:20 -06:00
lib.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
models.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
schema.py Search: fast ABC mode by default, opt-in deep search 2026-07-03 10:32:16 -06:00