pdf-quiz-generator/backend/app/models
Daniel 4d0cdc8f2f feat: section-level index so retrieval can cite a section, not a whole article
An article embedded as a single vector, which finds the article but not the
paragraph — so a citation could only ever point at the top of a page. Sections
live in a JSON column and cannot carry a vector or a full-text index, so they are
now projected into `article_section_index`: one row per section with its own
embedding and weighted tsvector (migration x6d7e8f9a0b1).

- Rows are keyed by section id, so editing a section updates it, removing one
  deletes it, and an unchanged section is not re-embedded on every save.
- `article_section` joins the embeddable kinds, so the retry task, the full
  regeneration and the health report cover it without further changes.
- `hybrid_ids(db, query, "article_section")` searches it like any other corpus.

This is the groundwork for grouped search results (article, then the sections
that matched) and for AI citations that deep-link to the right section.

Tests: 113 backend green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PpfzbZ1QTLMeVYxM2kyq8m
2026-09-10 02:18:53 +02:00
..
__init__.py feat: facet filters, personal libraries, adaptive shortcuts, restart, rename support 2026-09-09 04:31:40 +02:00
ai_model_config.py Tag filtering, multi-category, bug fixes, image validation, docs 2026-04-04 22:48:26 +02:00
article.py feat: section-level index so retrieval can cite a section, not a whole article 2026-09-10 02:18:53 +02:00
attempt.py feat: redesign quiz runner and add study tools 2026-09-07 03:10:23 +02:00
category_grant.py feat: analysis recommendations, category grants, compact question header 2026-09-09 18:47:32 +02:00
collection.py feat: facet filters, personal libraries, adaptive shortcuts, restart, rename support 2026-09-09 04:31:40 +02:00
comment.py feat: shareable quiz links, moderated comments and AI authoring 2026-09-07 17:10:08 +02:00
course.py Add LMS, user quiz creation, manual questions, course system 2026-04-05 02:07:04 +02:00
email_verification.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
embeddable.py feat: hybrid search for articles and cards; full-page question editor 2026-09-10 02:01:35 +02:00
exam.py feat: exams as real data, AI-mode matching, and a continue-study panel 2026-09-10 02:08:38 +02:00
favorite.py Add switchable embedding model, Polly toggle, job cancellation, and UI fixes 2026-04-03 20:44:11 +02:00
flashcard.py feat: hybrid search for articles and cards; full-page question editor 2026-09-10 02:01:35 +02:00
lab_reference.py feat: Orthobullets-style lab panel with source deep links and card links 2026-09-08 16:20:55 +02:00
password_reset.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
pdf_document.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
question.py feat: hybrid search on BGE-M3, with embedding provenance and a retry job 2026-09-09 23:45:33 +02:00
question_category.py feat: multi-subcategory questions, statistics hardening, seeded lab values 2026-09-08 14:43:22 +02:00
quiz.py feat: key points smart links, difficulty tags, adaptive sessions, educator-only question management 2026-09-09 02:26:45 +02:00
quiz_category.py Major: categories, question bank, security fixes, mobile layout, UX improvements 2026-03-31 20:08:05 +02:00
quiz_question_link.py Junction table for shared questions; verification blocking; semantic bank search; bug fixes 2026-04-01 00:55:13 +02:00
reminder.py Add switchable embedding model, Polly toggle, job cancellation, and UI fixes 2026-04-03 20:44:11 +02:00
section.py CRITICAL: Remove cascade delete from Section→Quiz relationship 2026-04-01 18:26:22 +02:00
user.py feat: exams as real data, AI-mode matching, and a continue-study panel 2026-09-10 02:08:38 +02:00
user_note.py Add persistent MyNote for quizzes 2026-05-12 17:51:23 +02:00