feat: extensible search engine with person entities (FTS5/tsvector)

This commit is contained in:
2026-05-12 18:45:24 +02:00
parent 763d622601
commit c6770659c5
45 changed files with 2421 additions and 86 deletions

View File

@@ -0,0 +1,25 @@
CREATE TABLE IF NOT EXISTS persons (
id TEXT PRIMARY KEY,
external_id TEXT NOT NULL UNIQUE,
tmdb_person_id BIGINT UNIQUE,
name TEXT NOT NULL,
known_for_department TEXT,
profile_path TEXT
);
CREATE INDEX IF NOT EXISTS idx_persons_external ON persons (external_id);
CREATE INDEX IF NOT EXISTS idx_persons_tmdb_id ON persons (tmdb_person_id);
-- tsvector-based search for movies (equivalent of SQLite FTS5)
CREATE TABLE IF NOT EXISTS movies_search (
movie_id TEXT PRIMARY KEY REFERENCES movies(id) ON DELETE CASCADE,
fts TSVECTOR NOT NULL DEFAULT ''
);
CREATE INDEX IF NOT EXISTS idx_movies_search_fts ON movies_search USING GIN(fts);
-- tsvector-based search for people
CREATE TABLE IF NOT EXISTS people_search (
person_id TEXT PRIMARY KEY REFERENCES persons(id) ON DELETE CASCADE,
fts TSVECTOR NOT NULL DEFAULT ''
);
CREATE INDEX IF NOT EXISTS idx_people_search_fts ON people_search USING GIN(fts);