diff --git a/scene_search/database.py b/scene_search/database.py index dd59ae1..62e2767 100644 --- a/scene_search/database.py +++ b/scene_search/database.py @@ -115,6 +115,13 @@ def _ensure_frame_caption_columns(con: sqlite3.Connection) -> None: for name, sql_type in additions.items(): if name not in columns: con.execute(f"ALTER TABLE frames ADD COLUMN {name} {sql_type}") + con.execute( + """ + CREATE INDEX IF NOT EXISTS idx_frames_unsynced_caption + ON frames(meili_synced_at) + WHERE caption IS NOT NULL + """ + ) def init_db(path: Path) -> None: