Add full-text search: tsvector column, GIN index, trigger, search endpoint #84
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-api!84
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "83-add-fulltext-search-tsvector"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds Postgres full-text search to pal-e-docs. A tsvector column with weighted ranking (title=A, html_content=B, slug=C) is auto-maintained by a Postgres trigger. A new
GET /notes/searchendpoint returns ranked results with headline snippets, replacing the current pattern of enumerating all notes via multiple API calls.Changes
alembic/versions/i9d0e1f2g3h4_add_search_vector.py— New migration: addssearch_vectortsvector column, GIN index, trigger function (notes_search_vector_update), trigger on INSERT/UPDATE, and backfills all existing rowssrc/pal_e_docs/models.py— Added comment documenting the server-managed search_vector column (not mapped in ORM to keep SQLite compatibility for tests)src/pal_e_docs/schemas.py— AddedNoteSearchResultschema (slug, title, note_type, status, project, headline, rank)src/pal_e_docs/routes/notes.py— AddedGET /notes/searchendpoint with query paramq, optional filters (note_type,project,status,tags), andlimitparameter. Returns 501 on SQLite.tests/test_search.py— Tests for 501 on SQLite, missing query param (422), empty query (422)Test Plan
ruff checkandruff formatpass cleanGET /notes/search?q=secrets+managementreturns ranked results with headline snippetsnote_type,project,status,tags) narrow results correctlyhtml_content— only summaries + snippetsReview Checklist
Related Notes
phase-postgres-5-fulltext-search— the phase this PR implementsplan-2026-02-26-tf-modularize-postgres— Phase 5 (Full-Text Search)